1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/cryptospi/cryptocharacteristics.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,704 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* crypto characteristics
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedAll
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __CRYPTOCHARACTERISTICS_H__
1.30 +#define __CRYPTOCHARACTERISTICS_H__
1.31 +
1.32 +#include <e32base.h>
1.33 +#include <e32hashtab.h>
1.34 +#include <cryptospi/plugincharacteristics.h>
1.35 +#include <cryptospi/cryptobaseapi.h>
1.36 +
1.37 +
1.38 +namespace CryptoSpi
1.39 + {
1.40 +
1.41 + /**
1.42 + The class holds the common characteristics of an interface.
1.43 + which is used for internalization.
1.44 + */
1.45 + NONSHARABLE_CLASS(CCharacteristics) : public CBase
1.46 + {
1.47 + public:
1.48 + /**
1.49 + Destructor
1.50 + */
1.51 + virtual ~CCharacteristics();
1.52 +
1.53 + /**
1.54 + Internalize this object from the supplied stream.
1.55 +
1.56 + @param aStream Stream to read CCharacteristics from.
1.57 + */
1.58 + virtual void InternalizeL(RReadStream& aStream);
1.59 +
1.60 + protected:
1.61 + /**
1.62 + * @internalComponent
1.63 + *
1.64 + * Constructor
1.65 + */
1.66 + CCharacteristics();
1.67 +
1.68 + public:
1.69 + /**
1.70 + Interface UID, e.g hash, symmetric cipher
1.71 + */
1.72 + TInt32 iInterfaceUid;
1.73 +
1.74 + /**
1.75 + Algorithm UID, e.g MD2, 3DES
1.76 + */
1.77 + TInt32 iAlgorithmUid;
1.78 +
1.79 + /**
1.80 + Implementaion UID
1.81 + */
1.82 + TInt32 iImplementationUid;
1.83 +
1.84 + /**
1.85 + Creator name
1.86 + */
1.87 + RBuf iCreatorName;
1.88 +
1.89 + /**
1.90 + whether the implementation is FIPS compliant
1.91 + */
1.92 + TBool iIsFIPSApproved;
1.93 +
1.94 + /**
1.95 + whether the implementation is a hardware one
1.96 + */
1.97 + TBool iIsHardwareSupported;
1.98 +
1.99 + /**
1.100 + the Maximum concurrent operation supported
1.101 + */
1.102 + TUint iMaxConcurrencySupported;
1.103 +
1.104 + /**
1.105 + the Algorithm Name
1.106 + */
1.107 + RBuf iAlgorithmName;
1.108 +
1.109 + /**
1.110 + The Latency
1.111 + */
1.112 + TInt iLatency;
1.113 +
1.114 + /**
1.115 + the Throughput
1.116 + */
1.117 + TInt iThroughput;
1.118 + };
1.119 +
1.120 + /**
1.121 + The class holds the hash characteristics.
1.122 + which is used for internalization.
1.123 + */
1.124 + NONSHARABLE_CLASS(CHashCharacteristics) : public CCharacteristics
1.125 + {
1.126 + public:
1.127 + /**
1.128 + @internalComponent
1.129 +
1.130 + Create a new instance of CHashCharacteristics.
1.131 +
1.132 + @return the pointer of the hash characteristic
1.133 + */
1.134 + static CHashCharacteristics* NewL();
1.135 +
1.136 + /**
1.137 + @internalComponent
1.138 +
1.139 + Create a new instance of CHashCharacteristics,
1.140 + Leave it on the cleanup stack.
1.141 +
1.142 + @return the pointer of the hash characteristic
1.143 + */
1.144 + static CHashCharacteristics* NewLC();
1.145 +
1.146 + /**
1.147 + Destructor
1.148 + */
1.149 + virtual ~CHashCharacteristics();
1.150 +
1.151 + /**
1.152 + Internalize this object from the supplied stream.
1.153 +
1.154 + @param aStream Stream to read CHashCharacteristics from.
1.155 + */
1.156 + virtual void InternalizeL(RReadStream& aStream);
1.157 +
1.158 + /**
1.159 + * @internalComponent
1.160 + *
1.161 + * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
1.162 + * by searching through iSupportedOperationModes for the UID value corresponding
1.163 + * to the aOperationMode parameter.
1.164 + * @param aOperationMode The UID of the operation mode to test
1.165 + * @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
1.166 + */
1.167 + TBool IsOperationModeSupported(TUid aOperationMode) const;
1.168 +
1.169 + private:
1.170 + /**
1.171 + Constructor
1.172 + */
1.173 + CHashCharacteristics();
1.174 + public:
1.175 + /**
1.176 + The internal block size of the hash in bits
1.177 + */
1.178 + TUint iBlockSize;
1.179 +
1.180 + /**
1.181 + the output size of the hash in bytes
1.182 + */
1.183 + TUint iOutputSize;
1.184 +
1.185 + /**
1.186 + The list of supported Operation modes
1.187 + */
1.188 + RArray<TInt32> iSupportedOperationModes;
1.189 + };
1.190 +
1.191 +
1.192 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
1.193 +
1.194 + /**
1.195 + * The class holds MAC characteristics which is used for internalization
1.196 + * in CryptoSpi framework.
1.197 + */
1.198 + NONSHARABLE_CLASS(CMacCharacteristics) : public CCharacteristics
1.199 + {
1.200 + public:
1.201 + /**
1.202 + * @internalComponent
1.203 + *
1.204 + * Create a new instance of CMacCharacteristics.
1.205 + *
1.206 + * @return the pointer of the Mac characteristic
1.207 + */
1.208 + static CMacCharacteristics* NewL();
1.209 +
1.210 + /**
1.211 + * @internalComponent
1.212 + *
1.213 + * Create a new instance of CMacCharacteristics, Leave it on the cleanup stack.
1.214 + *
1.215 + * @return the pointer of the Mac characteristic
1.216 + */
1.217 + static CMacCharacteristics* NewLC();
1.218 +
1.219 + /**
1.220 + * Destructor
1.221 + */
1.222 + virtual ~CMacCharacteristics();
1.223 +
1.224 + /**
1.225 + * Internalize this object from the supplied stream.
1.226 + *
1.227 + * @param aStream Stream to read CMacCharacteristics from.
1.228 + */
1.229 + virtual void InternalizeL(RReadStream& aStream);
1.230 +
1.231 + private:
1.232 + /**
1.233 + * Constructor
1.234 + */
1.235 + CMacCharacteristics();
1.236 +
1.237 + public:
1.238 + /**
1.239 + * The Mac mode : Hash based, Cipher based etc.
1.240 + */
1.241 + TInt32 iMacMode;
1.242 +
1.243 + /**
1.244 + * Characteristics of the underlying MAC algorithm
1.245 + */
1.246 + CCharacteristics* iAlgorithmChar;
1.247 + };
1.248 +
1.249 +#endif
1.250 +
1.251 + /**
1.252 + The class holds the random characteristics.
1.253 + which is used for internalization.
1.254 + */
1.255 + NONSHARABLE_CLASS(CRandomCharacteristics) : public CCharacteristics
1.256 + {
1.257 + public:
1.258 + /**
1.259 + @internalComponent
1.260 +
1.261 + Create a new instance of CRandomCharacteristics.
1.262 +
1.263 + @return the pointer of the random characteristic
1.264 + */
1.265 + static CRandomCharacteristics* NewL();
1.266 +
1.267 + /**
1.268 + @internalComponent
1.269 +
1.270 + Create a new instance of CRandomCharacteristics,
1.271 + and leave it on the cleanup stack.
1.272 +
1.273 + @return the pointer of the random characteristic
1.274 + */
1.275 + static CRandomCharacteristics* NewLC();
1.276 +
1.277 + /**
1.278 + Destructor
1.279 + */
1.280 + virtual ~CRandomCharacteristics();
1.281 +
1.282 + /**
1.283 + Internalize this object from the supplied stream.
1.284 +
1.285 + @param aStream Stream to read CRandomCharacteristics from.
1.286 + */
1.287 + virtual void InternalizeL(RReadStream& aStream);
1.288 +
1.289 + private:
1.290 + /**
1.291 + Constructor
1.292 + */
1.293 + CRandomCharacteristics();
1.294 +
1.295 + public:
1.296 + /**
1.297 + The bit map of blocking non-blocking mode
1.298 + */
1.299 + TUint iBlockingMode;
1.300 + };
1.301 +
1.302 + /**
1.303 + The class holds the symmetric cipher characteristics.
1.304 + which is used for internalization.
1.305 + */
1.306 + NONSHARABLE_CLASS(CSymmetricCipherCharacteristics) : public CCharacteristics
1.307 + {
1.308 + public:
1.309 + /**
1.310 + @internalComponent
1.311 +
1.312 + Create a new instance of CSymmetricCipherCharacteristics.
1.313 +
1.314 + @return the pointer of the symmetric cipher characteristic
1.315 + */
1.316 + static CSymmetricCipherCharacteristics* NewL();
1.317 +
1.318 + /**
1.319 + @internalComponent
1.320 +
1.321 + Create a new instance of CSymmetricCipherCharacteristics.
1.322 + Leave it on the cleanup stack.
1.323 +
1.324 + @return the pointer of the symmetric cipher characteristic
1.325 + */
1.326 + static CSymmetricCipherCharacteristics* NewLC();
1.327 +
1.328 + /**
1.329 + Destructor
1.330 + */
1.331 + virtual ~CSymmetricCipherCharacteristics();
1.332 +
1.333 + /**
1.334 + Internalize this object from the supplied stream.
1.335 +
1.336 + @param aStream Stream to read CSymmetricCipherCharacteristics from.
1.337 + */
1.338 + virtual void InternalizeL(RReadStream& aStream);
1.339 +
1.340 + /**
1.341 + @internalComponent
1.342 +
1.343 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.344 + by searching through iSupportedPaddingModes for the UID value corresponding
1.345 + to the aPaddingMode parameter.
1.346 + @param aPaddingMode The UID of the padding mode to test.
1.347 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.348 + */
1.349 + TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.350 +
1.351 + /**
1.352 + @internalComponent
1.353 +
1.354 + Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
1.355 + by searching through iSupportedOperationModes for the UID value corresponding
1.356 + to the aOperationMode parameter.
1.357 + @param aOperationMode The UID of the operation mode to test
1.358 + @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
1.359 + */
1.360 + TBool IsOperationModeSupported(TUid aOperationMode) const;
1.361 +
1.362 + private:
1.363 + /**
1.364 + Constructor
1.365 + */
1.366 + CSymmetricCipherCharacteristics();
1.367 +
1.368 + public:
1.369 + /**
1.370 + The maximum key length in bits
1.371 + */
1.372 + TUint iMaximumKeyLength;
1.373 +
1.374 + /**
1.375 + The block size of the cipher in bytes
1.376 + */
1.377 + TUint iBlockSize;
1.378 +
1.379 + /**
1.380 + The list of supported padding modes
1.381 + */
1.382 + RArray<TInt32> iSupportedPaddingModes;
1.383 +
1.384 + /**
1.385 + The list of supported Operation modes
1.386 + */
1.387 + RArray<TInt32> iSupportedOperationModes;
1.388 +
1.389 + /**
1.390 + The supported key mode bit map. e.g. extern key, internal key or both
1.391 + */
1.392 + TInt iKeySupportMode;
1.393 + };
1.394 +
1.395 + /**
1.396 + The class holds the asymmetric cipher characteristics.
1.397 + which is used for internalization.
1.398 + */
1.399 + NONSHARABLE_CLASS(CAsymmetricCipherCharacteristics) : public CCharacteristics
1.400 + {
1.401 + public:
1.402 + /**
1.403 + @internalComponent
1.404 +
1.405 + Create a new instance of CAsymmetricCipherCharacteristics.
1.406 +
1.407 + @return the pointer of the asymmetric cipher characteristic
1.408 + */
1.409 + static CAsymmetricCipherCharacteristics* NewL();
1.410 +
1.411 + /**
1.412 + @internalComponent
1.413 +
1.414 + Create a new instance of CAsymmetricCipherCharacteristics.
1.415 + Leave it on the cleanup stack.
1.416 +
1.417 + @return the pointer of the asymmetric cipher characteristic
1.418 + */
1.419 + static CAsymmetricCipherCharacteristics* NewLC();
1.420 +
1.421 + /**
1.422 + Destructor
1.423 + */
1.424 + virtual ~CAsymmetricCipherCharacteristics();
1.425 +
1.426 + /**
1.427 + Internalize this object from the supplied stream.
1.428 +
1.429 + @param aStream Stream to read CAsymmetricCipherCharacteristics from.
1.430 + */
1.431 + virtual void InternalizeL(RReadStream& aStream);
1.432 +
1.433 + /**
1.434 + @internalComponent
1.435 +
1.436 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.437 + by searching through iSupportedPaddingModes for the UID value corresponding
1.438 + to the aPaddingMode parameter.
1.439 + @param aPaddingMode The UID of the padding mode to test.
1.440 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.441 + */
1.442 + TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.443 +
1.444 + private:
1.445 + /**
1.446 + Constructor
1.447 + */
1.448 + CAsymmetricCipherCharacteristics();
1.449 +
1.450 + public:
1.451 + /**
1.452 + The maximum key length in bits
1.453 + */
1.454 + TUint iMaximumKeyLength;
1.455 +
1.456 + /**
1.457 + The list of supported padding modes
1.458 + */
1.459 + RArray<TInt32> iSupportedPaddingModes;
1.460 +
1.461 + /**
1.462 + The supported key mode bit map. e.g. extern key, internal key or both
1.463 + */
1.464 + TInt iKeySupportMode;
1.465 + };
1.466 +
1.467 +
1.468 + /**
1.469 + The class holds the signature characteristics.
1.470 + which is used for internalization.
1.471 + */
1.472 + NONSHARABLE_CLASS(CAsymmetricSignatureCharacteristics) : public CCharacteristics
1.473 + {
1.474 + public:
1.475 + /**
1.476 + @internalComponent
1.477 +
1.478 + Create a new instance of CAsymmetricSignatureCharacteristics.
1.479 +
1.480 + @return the pointer of the asymmetric signature characteristic
1.481 + */
1.482 + static CAsymmetricSignatureCharacteristics* NewL();
1.483 +
1.484 + /**
1.485 + @internalComponent
1.486 +
1.487 + Create a new instance of CAsymmetricSignatureCharacteristics.
1.488 + Leave it on the cleanup stack.
1.489 +
1.490 + @return the pointer of the asymmetric signature characteristic
1.491 + */
1.492 + static CAsymmetricSignatureCharacteristics* NewLC();
1.493 +
1.494 + /**
1.495 + Destructor
1.496 + */
1.497 + virtual ~CAsymmetricSignatureCharacteristics();
1.498 +
1.499 + /**
1.500 + Internalize this object from the supplied stream.
1.501 +
1.502 + @param aStream Stream to read CAsymmetricSignatureCharacteristics from.
1.503 + */
1.504 + virtual void InternalizeL(RReadStream& aStream);
1.505 +
1.506 + /**
1.507 + @internalComponent
1.508 +
1.509 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.510 + by searching through iSupportedPaddingModes for the UID value corresponding
1.511 + to the aPaddingMode parameter.
1.512 + @param aPaddingMode The UID of the padding mode to test.
1.513 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.514 + */
1.515 + TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.516 +
1.517 + private:
1.518 + /**
1.519 + Constructor
1.520 + */
1.521 + CAsymmetricSignatureCharacteristics();
1.522 +
1.523 + public:
1.524 + /**
1.525 + The maximum key length in bits
1.526 + */
1.527 + TUint iMaximumKeyLength;
1.528 +
1.529 + /**
1.530 + The list of supported padding modes
1.531 + */
1.532 + RArray<TInt32> iSupportedPaddingModes;
1.533 +
1.534 + /**
1.535 + The supported key mode bit map. e.g. extern key, internal key or both
1.536 + */
1.537 + TInt iKeySupportMode;
1.538 + };
1.539 +
1.540 + /**
1.541 + The class holds the key agreement characteristics.
1.542 + which is used for internalization.
1.543 + */
1.544 + NONSHARABLE_CLASS(CKeyAgreementCharacteristics) : public CCharacteristics
1.545 + {
1.546 + public:
1.547 + /**
1.548 + @internalComponent
1.549 +
1.550 + Create a new instance of CKeyAgreementCharacteristics.
1.551 +
1.552 + @return the pointer of the key agreement characteristic
1.553 + */
1.554 + static CKeyAgreementCharacteristics* NewL();
1.555 +
1.556 + /**
1.557 + @internalComponent
1.558 +
1.559 + Create a new instance of CKeyAgreementCharacteristics.
1.560 + Leave it on the cleanup stack.
1.561 +
1.562 + @return the pointer of the key agreement characteristic
1.563 + */
1.564 + static CKeyAgreementCharacteristics* NewLC();
1.565 +
1.566 + /**
1.567 + Destructor
1.568 + */
1.569 + virtual ~CKeyAgreementCharacteristics();
1.570 +
1.571 + /**
1.572 + Internalize this object from the supplied stream.
1.573 +
1.574 + @param aStream Stream to read CKeyAgreementCharacteristics from.
1.575 + */
1.576 + virtual void InternalizeL(RReadStream& aStream);
1.577 +
1.578 + private:
1.579 + /**
1.580 + Constructor
1.581 + */
1.582 + CKeyAgreementCharacteristics();
1.583 + };
1.584 +
1.585 + /**
1.586 + The class holds the key pair generator characteristics.
1.587 + which is used for internalization.
1.588 + */
1.589 + NONSHARABLE_CLASS(CKeypairGeneratorCharacteristics) : public CCharacteristics
1.590 + {
1.591 + public:
1.592 + /**
1.593 + @internalComponent
1.594 +
1.595 + Create a new instance of CKeypairGeneratorCharacteristics.
1.596 +
1.597 + @return the pointer of the keypair generator characteristic
1.598 + */
1.599 + static CKeypairGeneratorCharacteristics* NewL();
1.600 +
1.601 + /**
1.602 + @internalComponent
1.603 +
1.604 + Create a new instance of CKeypairGeneratorCharacteristics.
1.605 + Leave it on the cleanup stack.
1.606 +
1.607 + @return the pointer of the keypair generator characteristic
1.608 + */
1.609 + static CKeypairGeneratorCharacteristics* NewLC();
1.610 +
1.611 + /**
1.612 + Destructor
1.613 + */
1.614 + virtual ~CKeypairGeneratorCharacteristics();
1.615 +
1.616 + /**
1.617 + Internalize this object from the supplied stream.
1.618 +
1.619 + @param aStream Stream to read CKeyAgreementCharacteristics from.
1.620 + */
1.621 + virtual void InternalizeL(RReadStream& aStream);
1.622 +
1.623 + private:
1.624 + /**
1.625 + Constructor
1.626 + */
1.627 + CKeypairGeneratorCharacteristics();
1.628 + public:
1.629 + /**
1.630 + The maximum key length in bits
1.631 + */
1.632 + TUint iMaximumKeyLength;
1.633 + };
1.634 +
1.635 + /**
1.636 + The class holds characteristics and dll index.
1.637 + which is used for internalization.
1.638 + */
1.639 + NONSHARABLE_CLASS(CCharacteristicsAndPluginName) : public CBase
1.640 + {
1.641 + public:
1.642 + /**
1.643 + @internalComponent
1.644 +
1.645 + Create a new instance of CKeypairGeneratorCharacteristics.
1.646 +
1.647 + @param aInterface the interface uid
1.648 + @return the pointer of the keypair generator characteristic
1.649 + */
1.650 + static CCharacteristicsAndPluginName* NewL(TInt32 aInterface);
1.651 +
1.652 + /**
1.653 + @internalComponent
1.654 +
1.655 + Create a new instance of CKeypairGeneratorCharacteristics.
1.656 + Leave it on the cleanup stack.
1.657 +
1.658 + @param aInterface the interface uid
1.659 + @return the pointer of the keypair generator characteristic
1.660 + */
1.661 + static CCharacteristicsAndPluginName* NewLC(TInt32 aInterface);
1.662 +
1.663 + /**
1.664 + Destructor
1.665 + */
1.666 + virtual ~CCharacteristicsAndPluginName();
1.667 +
1.668 + /**
1.669 + @internalComponent
1.670 +
1.671 + Internalize this object from the supplied stream.
1.672 +
1.673 + @param aStream Stream to read CCharacteristicsAndPluginName from.
1.674 + */
1.675 + void InternalizeL(RReadStream& aStream);
1.676 +
1.677 + protected:
1.678 + /**
1.679 + * @internalComponent
1.680 + *
1.681 + * Constructors
1.682 + */
1.683 + CCharacteristicsAndPluginName();
1.684 + /** @internalComponent */
1.685 + void ConstructL(TInt32 aInterface);
1.686 +
1.687 + public:
1.688 + /**
1.689 + The characteristic of the crypto implementation
1.690 + */
1.691 + CCharacteristics* iCharacteristic;
1.692 +
1.693 + /**
1.694 + The extended characteristic of the crypto implementation
1.695 + */
1.696 + CExtendedCharacteristics* iExtendedCharacteristic;
1.697 +
1.698 + /**
1.699 + The name of the plugin dll which contains this implementation
1.700 + */
1.701 + TFileName iDllName;
1.702 + };
1.703 + }
1.704 +#endif //__CRYPTOCHARACTERISTICS_H__
1.705 +
1.706 +
1.707 +