Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * plugin characteristic definition
26 #ifndef __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
27 #define __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
30 #include <cryptospi/cryptoparams.h>
33 // Forward declarations
39 const TInt32 KInterfaceType = 0x10283527;
40 const TInt32 KAlgorithmType = 0x10283528;
41 const TInt32 KImplementationType = 0x10283529;
42 const TInt32 KCreatorNameType = 0x1028352A;
43 const TInt32 KIsFIPSApprovedType = 0x1028352B;
44 const TInt32 KIsHardwareSupportedType = 0x1028352C;
45 const TInt32 KMaxConcurrencySupportedType = 0x1028352D;
46 const TInt32 KLatencyType = 0x1028352E;
47 const TInt32 KThroughputType = 0x1028352F;
48 const TInt32 KBlockSizeType = 0x10283530;
49 const TInt32 KOutputSizeType = 0x10283531;
50 const TInt32 KSupportedOperationModesType = 0x10283532;
51 const TInt32 KBlockingModeType = 0x10283533;
52 const TInt32 KMaximumKeyLengthType = 0x10283534;
53 const TInt32 KSupportedPaddingModesType = 0x10283535;
54 const TInt32 KKeySupportModeType = 0x10283536;
55 const TInt32 KConcurrencyType = 0x10283537;
56 const TInt32 KExclusiveUseType = 0x10283538;
59 The following are the characteristic UIDs which should be used for Rules-based Selector
61 const TUid KNoneUid = {0x00000000};
62 const TUid KInterfaceTypeUid = {KInterfaceType};
63 const TUid KAlgorithmTypeUid = {KAlgorithmType};
64 const TUid KImplementationTypeUid = {KImplementationType};
65 const TUid KCreatorNameTypeUid = {KCreatorNameType};
66 const TUid KIsFIPSApprovedTypeUid = {KIsFIPSApprovedType};
67 const TUid KIsHardwareSupportedTypeUid = {KIsHardwareSupportedType};
68 const TUid KMaxConcurrencySupportedTypeUid = {KMaxConcurrencySupportedType};
69 const TUid KLatencyTypeUid = {KLatencyType};
70 const TUid KThroughputTypeUid = {KThroughputType};
71 const TUid KBlockSizeTypeUid = {KBlockSizeType};
72 const TUid KOutputSizeTypeUid = {KOutputSizeType};
73 const TUid KSupportedOperationModesTypeUid = {KSupportedOperationModesType};
74 const TUid KBlockingModeTypeUid = {KBlockingModeType};
75 const TUid KMaximumKeyLengthTypeUid = {KMaximumKeyLengthType};
76 const TUid KSupportedPaddingModesTypeUid = {KSupportedPaddingModesType};
77 const TUid KKeySupportModeTypeUid = {KKeySupportModeType};
78 const TUid KConcurrencyTypeUid = {KConcurrencyType};
79 const TUid KExclusiveUseTypeUid = {KExclusiveUseType};
81 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
82 const TInt32 KMacModeType = 0x2001ED9F;
83 const TUid KMacModeTypeUid = {KMacModeType};
87 typedef TAny TCharacteristics;
90 Common characteristics for all plug-in interface types.
92 This MUST be the first element of each characteristics "sub-class" to
93 allow sub-classes to be cast directly to a TCommonCharacteristics. This
94 is used instead of inheritance because it enables arrays of characteristics
95 objects to be defined as static constant data.
97 class TCommonCharacteristics
104 * Externalises common characteristics to a write stream.
106 * @param aStream Stream to which the object should be externalised.
108 void ExternalizeL(RWriteStream& aStream) const;
112 Interface UID, e.g hash, symmetric cipher
114 TInt32 iInterfaceUID;
117 Algorithm UID, e.g MD2, 3DES
119 TInt32 iAlgorithmUID;
124 TInt32 iImplementationUID;
129 const TRomLitC16* iCreatorName;
132 whether the implementation is FIPS compliant
134 TBool iIsFIPSApproved;
137 whether the implementation is a hardware one
139 TBool iIsHardwareSupported;
142 the Maximum concurrent operation supported
144 TUint iMaxConcurrencySupported;
149 const TRomLitC16* iAlgorithmName;
165 class THashCharacteristics
171 * Externalises hash characteristics to a write stream.
173 * @param aStream Stream to which the object should be externalised.
175 void ExternalizeL(RWriteStream& aStream) const;
180 * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
181 * by searching through iSupportedOperationModes for the UID value corresponding
182 * to the aOperationMode parameter.
184 * @param aOperationMode The UID of the operation mode to test
185 * @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
187 IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;
191 Common characteristics
193 TCommonCharacteristics cmn;
196 The internal block size of the hash in bits
201 the output size of the hash in bits
206 The list of supported Operation modes
208 const TInt32* iSupportedOperationModes;
211 Number of the supported Operation mode
213 TUint iOperationModeNum;
217 Random Characteristics
219 class TRandomCharacteristics
225 * Externalises random characteristics to a write stream.
227 * @param aStream Stream to which the object should be externalised.
229 void ExternalizeL(RWriteStream& aStream) const;
232 Common characteristics
234 TCommonCharacteristics cmn;
237 The bit map of blocking non-blocking mode
244 Symmetric Cipher Chararcteristics
246 class TSymmetricCipherCharacteristics
252 * Externalises symmetric cipher characteristics to a write stream.
254 * @param aStream Stream to which the object should be externalised.
256 void ExternalizeL(RWriteStream& aStream) const;
259 Determines whether an operation mode (e.g. CBC) is supported by the plug-in
260 by searching through iSupportedOperationModes for the UID value corresponding
261 to the aOperationMode parameter.
262 @param aOperationMode The UID of the operation mode to test
263 @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
265 IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;
268 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
269 by searching through iSupportedPaddingModes for the UID value corresponding
270 to the aPaddingMode parameter.
271 @param aPaddingMode The UID of the padding mode to test.
272 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
274 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
278 Common characteristics
280 TCommonCharacteristics cmn;
283 The maximum key length in bits
285 TUint iMaximumKeyLength;
288 The block size of the cipher in bits
293 The list of supported padding modes
295 const TInt32* iSupportedPaddingModes;
298 Number of the supported padding mode
300 TUint iPaddingModeNum;
303 The list of supported Operation modes
305 const TInt32* iSupportedOperationModes;
308 Number of the supported Operation mode
310 TUint iOperationModeNum;
313 The supported key mode bit map. e.g. extern key, internal key or both
315 TInt iKeySupportMode;
319 Asymmetric Cipher Characteristics
321 class TAsymmetricCipherCharacteristics
327 * Externalises asymmetric cipher characteristics to a write stream.
329 * @param aStream Stream to which the object should be externalised.
331 void ExternalizeL(RWriteStream& aStream) const;
334 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
335 by searching through iSupportedPaddingModes for the UID value corresponding
336 to the aPaddingMode parameter.
337 @param aPaddingMode The UID of the padding mode to test.
338 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
340 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
344 Common characteristics
346 TCommonCharacteristics cmn;
348 The maximum key length in bits
350 TUint iMaximumKeyLength;
353 The list of supported padding modes
355 const TInt32* iSupportedPaddingModes;
358 Number of the supported padding mode
360 TInt iPaddingModeNum;
363 The supported key mode bit map. e.g. extern key, internal key or both
365 TInt iKeySupportMode;
369 Signature Characteristics
371 class TAsymmetricSignatureCharacteristics
377 * Externalises signature characteristics to a write stream.
379 * @param aStream Stream to which the object should be externalised.
381 void ExternalizeL(RWriteStream& aStream) const;
384 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
385 by searching through iSupportedPaddingModes for the UID value corresponding
386 to the aPaddingMode parameter.
387 @param aPaddingMode The UID of the padding mode to test.
388 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
390 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
394 Common characteristics
396 TCommonCharacteristics cmn;
399 The maximum key length in bits
401 TUint iMaximumKeyLength;
404 The list of supported padding modes
406 const TInt32* iSupportedPaddingModes;
409 Number of the supported padding mode
411 TInt iPaddingModeNum;
414 The supported key mode bit map. e.g. extern key, internal key or both
416 TInt iKeySupportMode;
421 Key Agreement Characteristics
423 class TKeyAgreementCharacteristics
429 * Externalises key agreement characteristics to a write stream.
431 * @param aStream Stream to which the object should be externalised.
433 void ExternalizeL(RWriteStream& aStream) const;
437 Common characteristics
439 TCommonCharacteristics cmn;
443 Asymmetric Keypair Generator Characteristics
445 class TAsymmetricKeypairGeneratorCharacteristics
451 * Externalises key pair generator characteristics to a write stream.
453 * @param aStream Stream to which the object should be externalised.
455 void ExternalizeL(RWriteStream& aStream) const;
459 Common characteristics
461 TCommonCharacteristics cmn;
464 The maximum key length that may be generarted in bits
466 TUint iMaximumKeyLength;
469 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
471 * Mac Characteristics
473 class TMacCharacteristics
479 * Externalises hash characteristics to a write stream.
481 * @param aStream Stream to which the object should be externalised.
483 void ExternalizeL(RWriteStream& aStream) const;
488 * Common Characteristics
490 TCommonCharacteristics iMacChar;
493 * Mac Mode Type UID will be used to select the plug-in implementations.
494 * The mode can be either hash or symmetric cipher based.
499 * The following pointers are mutually exclusive in their usage and anytime
500 * only one will be initialised depending upon the Mac mode type the plug-in
501 * supports, those not supported will be NULL.
505 * Initialised if 'iMacMode' is Hash based otherwise will be NULL.
507 const THashCharacteristics* iHashAlgorithmChar;
509 * Initialised if 'iMacMode' is Symmetric Cipher based otherwise will be NULL.
511 const TSymmetricCipherCharacteristics* iCipherAlgorithmChar;
515 #endif //__CRYPTOAPI_PLUGINCHARACTERISTICS_H__