1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/cryptospi/plugincharacteristics.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,515 @@
1.4 +/*
1.5 +* Copyright (c) 2006-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 +* plugin characteristic definition
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 __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
1.30 +#define __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
1.31 +
1.32 +#include <e32base.h>
1.33 +#include <cryptospi/cryptoparams.h>
1.34 +#include <s32mem.h>
1.35 +
1.36 +// Forward declarations
1.37 +struct TRomLitC16;
1.38 +
1.39 +
1.40 +namespace CryptoSpi
1.41 + {
1.42 + const TInt32 KInterfaceType = 0x10283527;
1.43 + const TInt32 KAlgorithmType = 0x10283528;
1.44 + const TInt32 KImplementationType = 0x10283529;
1.45 + const TInt32 KCreatorNameType = 0x1028352A;
1.46 + const TInt32 KIsFIPSApprovedType = 0x1028352B;
1.47 + const TInt32 KIsHardwareSupportedType = 0x1028352C;
1.48 + const TInt32 KMaxConcurrencySupportedType = 0x1028352D;
1.49 + const TInt32 KLatencyType = 0x1028352E;
1.50 + const TInt32 KThroughputType = 0x1028352F;
1.51 + const TInt32 KBlockSizeType = 0x10283530;
1.52 + const TInt32 KOutputSizeType = 0x10283531;
1.53 + const TInt32 KSupportedOperationModesType = 0x10283532;
1.54 + const TInt32 KBlockingModeType = 0x10283533;
1.55 + const TInt32 KMaximumKeyLengthType = 0x10283534;
1.56 + const TInt32 KSupportedPaddingModesType = 0x10283535;
1.57 + const TInt32 KKeySupportModeType = 0x10283536;
1.58 + const TInt32 KConcurrencyType = 0x10283537;
1.59 + const TInt32 KExclusiveUseType = 0x10283538;
1.60 +
1.61 + /**
1.62 + The following are the characteristic UIDs which should be used for Rules-based Selector
1.63 + */
1.64 + const TUid KNoneUid = {0x00000000};
1.65 + const TUid KInterfaceTypeUid = {KInterfaceType};
1.66 + const TUid KAlgorithmTypeUid = {KAlgorithmType};
1.67 + const TUid KImplementationTypeUid = {KImplementationType};
1.68 + const TUid KCreatorNameTypeUid = {KCreatorNameType};
1.69 + const TUid KIsFIPSApprovedTypeUid = {KIsFIPSApprovedType};
1.70 + const TUid KIsHardwareSupportedTypeUid = {KIsHardwareSupportedType};
1.71 + const TUid KMaxConcurrencySupportedTypeUid = {KMaxConcurrencySupportedType};
1.72 + const TUid KLatencyTypeUid = {KLatencyType};
1.73 + const TUid KThroughputTypeUid = {KThroughputType};
1.74 + const TUid KBlockSizeTypeUid = {KBlockSizeType};
1.75 + const TUid KOutputSizeTypeUid = {KOutputSizeType};
1.76 + const TUid KSupportedOperationModesTypeUid = {KSupportedOperationModesType};
1.77 + const TUid KBlockingModeTypeUid = {KBlockingModeType};
1.78 + const TUid KMaximumKeyLengthTypeUid = {KMaximumKeyLengthType};
1.79 + const TUid KSupportedPaddingModesTypeUid = {KSupportedPaddingModesType};
1.80 + const TUid KKeySupportModeTypeUid = {KKeySupportModeType};
1.81 + const TUid KConcurrencyTypeUid = {KConcurrencyType};
1.82 + const TUid KExclusiveUseTypeUid = {KExclusiveUseType};
1.83 +
1.84 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
1.85 + const TInt32 KMacModeType = 0x2001ED9F;
1.86 + const TUid KMacModeTypeUid = {KMacModeType};
1.87 +#endif
1.88 +
1.89 +
1.90 + typedef TAny TCharacteristics;
1.91 +
1.92 + /**
1.93 + Common characteristics for all plug-in interface types.
1.94 +
1.95 + This MUST be the first element of each characteristics "sub-class" to
1.96 + allow sub-classes to be cast directly to a TCommonCharacteristics. This
1.97 + is used instead of inheritance because it enables arrays of characteristics
1.98 + objects to be defined as static constant data.
1.99 + */
1.100 + class TCommonCharacteristics
1.101 + {
1.102 + public:
1.103 +
1.104 + /**
1.105 + * @internalComponent
1.106 + *
1.107 + * Externalises common characteristics to a write stream.
1.108 + *
1.109 + * @param aStream Stream to which the object should be externalised.
1.110 + */
1.111 + void ExternalizeL(RWriteStream& aStream) const;
1.112 +
1.113 + public:
1.114 + /**
1.115 + Interface UID, e.g hash, symmetric cipher
1.116 + */
1.117 + TInt32 iInterfaceUID;
1.118 +
1.119 + /**
1.120 + Algorithm UID, e.g MD2, 3DES
1.121 + */
1.122 + TInt32 iAlgorithmUID;
1.123 +
1.124 + /**
1.125 + Implementaion UID
1.126 + */
1.127 + TInt32 iImplementationUID;
1.128 +
1.129 + /**
1.130 + Creator name
1.131 + */
1.132 + const TRomLitC16* iCreatorName;
1.133 +
1.134 + /**
1.135 + whether the implementation is FIPS compliant
1.136 + */
1.137 + TBool iIsFIPSApproved;
1.138 +
1.139 + /**
1.140 + whether the implementation is a hardware one
1.141 + */
1.142 + TBool iIsHardwareSupported;
1.143 +
1.144 + /**
1.145 + the Maximum concurrent operation supported
1.146 + */
1.147 + TUint iMaxConcurrencySupported;
1.148 +
1.149 + /**
1.150 + the Algorithm Name
1.151 + */
1.152 + const TRomLitC16* iAlgorithmName;
1.153 +
1.154 + /**
1.155 + The Latency
1.156 + */
1.157 + TInt iLatency;
1.158 +
1.159 + /**
1.160 + the Throughput
1.161 + */
1.162 + TInt iThroughput;
1.163 + };
1.164 +
1.165 + /**
1.166 + Hash Characteristics
1.167 + */
1.168 + class THashCharacteristics
1.169 + {
1.170 + public:
1.171 + /**
1.172 + * @internalComponent
1.173 + *
1.174 + * Externalises hash characteristics to a write stream.
1.175 + *
1.176 + * @param aStream Stream to which the object should be externalised.
1.177 + **/
1.178 + void ExternalizeL(RWriteStream& aStream) const;
1.179 +
1.180 + /**
1.181 + * @deprecated
1.182 + *
1.183 + * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
1.184 + * by searching through iSupportedOperationModes for the UID value corresponding
1.185 + * to the aOperationMode parameter.
1.186 + *
1.187 + * @param aOperationMode The UID of the operation mode to test
1.188 + * @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
1.189 + */
1.190 + IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;
1.191 +
1.192 + public:
1.193 + /**
1.194 + Common characteristics
1.195 + */
1.196 + TCommonCharacteristics cmn;
1.197 +
1.198 + /**
1.199 + The internal block size of the hash in bits
1.200 + */
1.201 + TUint iBlockSize;
1.202 +
1.203 + /**
1.204 + the output size of the hash in bits
1.205 + */
1.206 + TUint iOutputSize;
1.207 +
1.208 + /**
1.209 + The list of supported Operation modes
1.210 + */
1.211 + const TInt32* iSupportedOperationModes;
1.212 +
1.213 + /**
1.214 + Number of the supported Operation mode
1.215 + */
1.216 + TUint iOperationModeNum;
1.217 + };
1.218 +
1.219 + /**
1.220 + Random Characteristics
1.221 + */
1.222 + class TRandomCharacteristics
1.223 + {
1.224 + public:
1.225 + /**
1.226 + * @internalComponent
1.227 + *
1.228 + * Externalises random characteristics to a write stream.
1.229 + *
1.230 + * @param aStream Stream to which the object should be externalised.
1.231 + **/
1.232 + void ExternalizeL(RWriteStream& aStream) const;
1.233 + public:
1.234 + /**
1.235 + Common characteristics
1.236 + */
1.237 + TCommonCharacteristics cmn;
1.238 +
1.239 + /**
1.240 + The bit map of blocking non-blocking mode
1.241 + */
1.242 + TUint iBlockingMode;
1.243 + };
1.244 +
1.245 +
1.246 + /**
1.247 + Symmetric Cipher Chararcteristics
1.248 + */
1.249 + class TSymmetricCipherCharacteristics
1.250 + {
1.251 + public:
1.252 + /**
1.253 + * @internalComponent
1.254 + *
1.255 + * Externalises symmetric cipher characteristics to a write stream.
1.256 + *
1.257 + * @param aStream Stream to which the object should be externalised.
1.258 + **/
1.259 + void ExternalizeL(RWriteStream& aStream) const;
1.260 +
1.261 + /**
1.262 + Determines whether an operation mode (e.g. CBC) is supported by the plug-in
1.263 + by searching through iSupportedOperationModes for the UID value corresponding
1.264 + to the aOperationMode parameter.
1.265 + @param aOperationMode The UID of the operation mode to test
1.266 + @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
1.267 + */
1.268 + IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;
1.269 +
1.270 + /**
1.271 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.272 + by searching through iSupportedPaddingModes for the UID value corresponding
1.273 + to the aPaddingMode parameter.
1.274 + @param aPaddingMode The UID of the padding mode to test.
1.275 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.276 + */
1.277 + IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.278 +
1.279 + public:
1.280 + /**
1.281 + Common characteristics
1.282 + */
1.283 + TCommonCharacteristics cmn;
1.284 +
1.285 + /**
1.286 + The maximum key length in bits
1.287 + */
1.288 + TUint iMaximumKeyLength;
1.289 +
1.290 + /**
1.291 + The block size of the cipher in bits
1.292 + */
1.293 + TUint iBlockSize;
1.294 +
1.295 + /**
1.296 + The list of supported padding modes
1.297 + */
1.298 + const TInt32* iSupportedPaddingModes;
1.299 +
1.300 + /**
1.301 + Number of the supported padding mode
1.302 + */
1.303 + TUint iPaddingModeNum;
1.304 +
1.305 + /**
1.306 + The list of supported Operation modes
1.307 + */
1.308 + const TInt32* iSupportedOperationModes;
1.309 +
1.310 + /**
1.311 + Number of the supported Operation mode
1.312 + */
1.313 + TUint iOperationModeNum;
1.314 +
1.315 + /**
1.316 + The supported key mode bit map. e.g. extern key, internal key or both
1.317 + */
1.318 + TInt iKeySupportMode;
1.319 + };
1.320 +
1.321 + /**
1.322 + Asymmetric Cipher Characteristics
1.323 + */
1.324 + class TAsymmetricCipherCharacteristics
1.325 + {
1.326 + public:
1.327 + /**
1.328 + * @internalComponent
1.329 + *
1.330 + * Externalises asymmetric cipher characteristics to a write stream.
1.331 + *
1.332 + * @param aStream Stream to which the object should be externalised.
1.333 + **/
1.334 + void ExternalizeL(RWriteStream& aStream) const;
1.335 +
1.336 + /**
1.337 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.338 + by searching through iSupportedPaddingModes for the UID value corresponding
1.339 + to the aPaddingMode parameter.
1.340 + @param aPaddingMode The UID of the padding mode to test.
1.341 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.342 + */
1.343 + IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.344 +
1.345 + public:
1.346 + /**
1.347 + Common characteristics
1.348 + */
1.349 + TCommonCharacteristics cmn;
1.350 + /**
1.351 + The maximum key length in bits
1.352 + */
1.353 + TUint iMaximumKeyLength;
1.354 +
1.355 + /**
1.356 + The list of supported padding modes
1.357 + */
1.358 + const TInt32* iSupportedPaddingModes;
1.359 +
1.360 + /**
1.361 + Number of the supported padding mode
1.362 + */
1.363 + TInt iPaddingModeNum;
1.364 +
1.365 + /**
1.366 + The supported key mode bit map. e.g. extern key, internal key or both
1.367 + */
1.368 + TInt iKeySupportMode;
1.369 + };
1.370 +
1.371 + /**
1.372 + Signature Characteristics
1.373 + */
1.374 + class TAsymmetricSignatureCharacteristics
1.375 + {
1.376 + public:
1.377 + /**
1.378 + * @internalComponent
1.379 + *
1.380 + * Externalises signature characteristics to a write stream.
1.381 + *
1.382 + * @param aStream Stream to which the object should be externalised.
1.383 + **/
1.384 + void ExternalizeL(RWriteStream& aStream) const;
1.385 +
1.386 + /**
1.387 + Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
1.388 + by searching through iSupportedPaddingModes for the UID value corresponding
1.389 + to the aPaddingMode parameter.
1.390 + @param aPaddingMode The UID of the padding mode to test.
1.391 + @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
1.392 + */
1.393 + IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
1.394 +
1.395 + public:
1.396 + /**
1.397 + Common characteristics
1.398 + */
1.399 + TCommonCharacteristics cmn;
1.400 +
1.401 + /**
1.402 + The maximum key length in bits
1.403 + */
1.404 + TUint iMaximumKeyLength;
1.405 +
1.406 + /**
1.407 + The list of supported padding modes
1.408 + */
1.409 + const TInt32* iSupportedPaddingModes;
1.410 +
1.411 + /**
1.412 + Number of the supported padding mode
1.413 + */
1.414 + TInt iPaddingModeNum;
1.415 +
1.416 + /**
1.417 + The supported key mode bit map. e.g. extern key, internal key or both
1.418 + */
1.419 + TInt iKeySupportMode;
1.420 + };
1.421 +
1.422 +
1.423 + /**
1.424 + Key Agreement Characteristics
1.425 + */
1.426 + class TKeyAgreementCharacteristics
1.427 + {
1.428 + public:
1.429 + /**
1.430 + * @internalComponent
1.431 + *
1.432 + * Externalises key agreement characteristics to a write stream.
1.433 + *
1.434 + * @param aStream Stream to which the object should be externalised.
1.435 + **/
1.436 + void ExternalizeL(RWriteStream& aStream) const;
1.437 +
1.438 + public:
1.439 + /**
1.440 + Common characteristics
1.441 + */
1.442 + TCommonCharacteristics cmn;
1.443 + };
1.444 +
1.445 + /**
1.446 + Asymmetric Keypair Generator Characteristics
1.447 + */
1.448 + class TAsymmetricKeypairGeneratorCharacteristics
1.449 + {
1.450 + public:
1.451 + /**
1.452 + * @internalComponent
1.453 + *
1.454 + * Externalises key pair generator characteristics to a write stream.
1.455 + *
1.456 + * @param aStream Stream to which the object should be externalised.
1.457 + **/
1.458 + void ExternalizeL(RWriteStream& aStream) const;
1.459 +
1.460 + public:
1.461 + /**
1.462 + Common characteristics
1.463 + */
1.464 + TCommonCharacteristics cmn;
1.465 +
1.466 + /**
1.467 + The maximum key length that may be generarted in bits
1.468 + */
1.469 + TUint iMaximumKeyLength;
1.470 + };
1.471 +
1.472 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
1.473 + /**
1.474 + * Mac Characteristics
1.475 + */
1.476 + class TMacCharacteristics
1.477 + {
1.478 + public:
1.479 + /**
1.480 + * @internalComponent
1.481 + *
1.482 + * Externalises hash characteristics to a write stream.
1.483 + *
1.484 + * @param aStream Stream to which the object should be externalised.
1.485 + */
1.486 + void ExternalizeL(RWriteStream& aStream) const;
1.487 +
1.488 + public:
1.489 +
1.490 + /**
1.491 + * Common Characteristics
1.492 + */
1.493 + TCommonCharacteristics iMacChar;
1.494 +
1.495 + /**
1.496 + * Mac Mode Type UID will be used to select the plug-in implementations.
1.497 + * The mode can be either hash or symmetric cipher based.
1.498 + */
1.499 + TInt32 iMacMode;
1.500 +
1.501 + /**
1.502 + * The following pointers are mutually exclusive in their usage and anytime
1.503 + * only one will be initialised depending upon the Mac mode type the plug-in
1.504 + * supports, those not supported will be NULL.
1.505 + */
1.506 +
1.507 + /**
1.508 + * Initialised if 'iMacMode' is Hash based otherwise will be NULL.
1.509 + */
1.510 + const THashCharacteristics* iHashAlgorithmChar;
1.511 + /**
1.512 + * Initialised if 'iMacMode' is Symmetric Cipher based otherwise will be NULL.
1.513 + */
1.514 + const TSymmetricCipherCharacteristics* iCipherAlgorithmChar;
1.515 + };
1.516 +#endif
1.517 + }
1.518 +#endif //__CRYPTOAPI_PLUGINCHARACTERISTICS_H__