2 * Copyright (c) 2007-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 * crypto characteristics
26 #ifndef __CRYPTOCHARACTERISTICS_H__
27 #define __CRYPTOCHARACTERISTICS_H__
30 #include <e32hashtab.h>
31 #include <cryptospi/plugincharacteristics.h>
32 #include <cryptospi/cryptobaseapi.h>
39 The class holds the common characteristics of an interface.
40 which is used for internalization.
42 NONSHARABLE_CLASS(CCharacteristics) : public CBase
48 virtual ~CCharacteristics();
51 Internalize this object from the supplied stream.
53 @param aStream Stream to read CCharacteristics from.
55 virtual void InternalizeL(RReadStream& aStream);
67 Interface UID, e.g hash, symmetric cipher
72 Algorithm UID, e.g MD2, 3DES
79 TInt32 iImplementationUid;
87 whether the implementation is FIPS compliant
89 TBool iIsFIPSApproved;
92 whether the implementation is a hardware one
94 TBool iIsHardwareSupported;
97 the Maximum concurrent operation supported
99 TUint iMaxConcurrencySupported;
118 The class holds the hash characteristics.
119 which is used for internalization.
121 NONSHARABLE_CLASS(CHashCharacteristics) : public CCharacteristics
127 Create a new instance of CHashCharacteristics.
129 @return the pointer of the hash characteristic
131 static CHashCharacteristics* NewL();
136 Create a new instance of CHashCharacteristics,
137 Leave it on the cleanup stack.
139 @return the pointer of the hash characteristic
141 static CHashCharacteristics* NewLC();
146 virtual ~CHashCharacteristics();
149 Internalize this object from the supplied stream.
151 @param aStream Stream to read CHashCharacteristics from.
153 virtual void InternalizeL(RReadStream& aStream);
158 * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
159 * by searching through iSupportedOperationModes for the UID value corresponding
160 * to the aOperationMode parameter.
161 * @param aOperationMode The UID of the operation mode to test
162 * @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
164 TBool IsOperationModeSupported(TUid aOperationMode) const;
170 CHashCharacteristics();
173 The internal block size of the hash in bits
178 the output size of the hash in bytes
183 The list of supported Operation modes
185 RArray<TInt32> iSupportedOperationModes;
189 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
192 * The class holds MAC characteristics which is used for internalization
193 * in CryptoSpi framework.
195 NONSHARABLE_CLASS(CMacCharacteristics) : public CCharacteristics
201 * Create a new instance of CMacCharacteristics.
203 * @return the pointer of the Mac characteristic
205 static CMacCharacteristics* NewL();
210 * Create a new instance of CMacCharacteristics, Leave it on the cleanup stack.
212 * @return the pointer of the Mac characteristic
214 static CMacCharacteristics* NewLC();
219 virtual ~CMacCharacteristics();
222 * Internalize this object from the supplied stream.
224 * @param aStream Stream to read CMacCharacteristics from.
226 virtual void InternalizeL(RReadStream& aStream);
232 CMacCharacteristics();
236 * The Mac mode : Hash based, Cipher based etc.
241 * Characteristics of the underlying MAC algorithm
243 CCharacteristics* iAlgorithmChar;
249 The class holds the random characteristics.
250 which is used for internalization.
252 NONSHARABLE_CLASS(CRandomCharacteristics) : public CCharacteristics
258 Create a new instance of CRandomCharacteristics.
260 @return the pointer of the random characteristic
262 static CRandomCharacteristics* NewL();
267 Create a new instance of CRandomCharacteristics,
268 and leave it on the cleanup stack.
270 @return the pointer of the random characteristic
272 static CRandomCharacteristics* NewLC();
277 virtual ~CRandomCharacteristics();
280 Internalize this object from the supplied stream.
282 @param aStream Stream to read CRandomCharacteristics from.
284 virtual void InternalizeL(RReadStream& aStream);
290 CRandomCharacteristics();
294 The bit map of blocking non-blocking mode
300 The class holds the symmetric cipher characteristics.
301 which is used for internalization.
303 NONSHARABLE_CLASS(CSymmetricCipherCharacteristics) : public CCharacteristics
309 Create a new instance of CSymmetricCipherCharacteristics.
311 @return the pointer of the symmetric cipher characteristic
313 static CSymmetricCipherCharacteristics* NewL();
318 Create a new instance of CSymmetricCipherCharacteristics.
319 Leave it on the cleanup stack.
321 @return the pointer of the symmetric cipher characteristic
323 static CSymmetricCipherCharacteristics* NewLC();
328 virtual ~CSymmetricCipherCharacteristics();
331 Internalize this object from the supplied stream.
333 @param aStream Stream to read CSymmetricCipherCharacteristics from.
335 virtual void InternalizeL(RReadStream& aStream);
340 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
341 by searching through iSupportedPaddingModes for the UID value corresponding
342 to the aPaddingMode parameter.
343 @param aPaddingMode The UID of the padding mode to test.
344 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
346 TBool IsPaddingModeSupported(TUid aPaddingMode) const;
351 Determines whether an operation mode (e.g. HMAC) is supported by the plug-in
352 by searching through iSupportedOperationModes for the UID value corresponding
353 to the aOperationMode parameter.
354 @param aOperationMode The UID of the operation mode to test
355 @return ETrue if the operation mode is supported; otherwise, EFalse is returned.
357 TBool IsOperationModeSupported(TUid aOperationMode) const;
363 CSymmetricCipherCharacteristics();
367 The maximum key length in bits
369 TUint iMaximumKeyLength;
372 The block size of the cipher in bytes
377 The list of supported padding modes
379 RArray<TInt32> iSupportedPaddingModes;
382 The list of supported Operation modes
384 RArray<TInt32> iSupportedOperationModes;
387 The supported key mode bit map. e.g. extern key, internal key or both
389 TInt iKeySupportMode;
393 The class holds the asymmetric cipher characteristics.
394 which is used for internalization.
396 NONSHARABLE_CLASS(CAsymmetricCipherCharacteristics) : public CCharacteristics
402 Create a new instance of CAsymmetricCipherCharacteristics.
404 @return the pointer of the asymmetric cipher characteristic
406 static CAsymmetricCipherCharacteristics* NewL();
411 Create a new instance of CAsymmetricCipherCharacteristics.
412 Leave it on the cleanup stack.
414 @return the pointer of the asymmetric cipher characteristic
416 static CAsymmetricCipherCharacteristics* NewLC();
421 virtual ~CAsymmetricCipherCharacteristics();
424 Internalize this object from the supplied stream.
426 @param aStream Stream to read CAsymmetricCipherCharacteristics from.
428 virtual void InternalizeL(RReadStream& aStream);
433 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
434 by searching through iSupportedPaddingModes for the UID value corresponding
435 to the aPaddingMode parameter.
436 @param aPaddingMode The UID of the padding mode to test.
437 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
439 TBool IsPaddingModeSupported(TUid aPaddingMode) const;
445 CAsymmetricCipherCharacteristics();
449 The maximum key length in bits
451 TUint iMaximumKeyLength;
454 The list of supported padding modes
456 RArray<TInt32> iSupportedPaddingModes;
459 The supported key mode bit map. e.g. extern key, internal key or both
461 TInt iKeySupportMode;
466 The class holds the signature characteristics.
467 which is used for internalization.
469 NONSHARABLE_CLASS(CAsymmetricSignatureCharacteristics) : public CCharacteristics
475 Create a new instance of CAsymmetricSignatureCharacteristics.
477 @return the pointer of the asymmetric signature characteristic
479 static CAsymmetricSignatureCharacteristics* NewL();
484 Create a new instance of CAsymmetricSignatureCharacteristics.
485 Leave it on the cleanup stack.
487 @return the pointer of the asymmetric signature characteristic
489 static CAsymmetricSignatureCharacteristics* NewLC();
494 virtual ~CAsymmetricSignatureCharacteristics();
497 Internalize this object from the supplied stream.
499 @param aStream Stream to read CAsymmetricSignatureCharacteristics from.
501 virtual void InternalizeL(RReadStream& aStream);
506 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in
507 by searching through iSupportedPaddingModes for the UID value corresponding
508 to the aPaddingMode parameter.
509 @param aPaddingMode The UID of the padding mode to test.
510 @return ETrue if the padding mode is supported; otherwise, EFalse is returned.
512 TBool IsPaddingModeSupported(TUid aPaddingMode) const;
518 CAsymmetricSignatureCharacteristics();
522 The maximum key length in bits
524 TUint iMaximumKeyLength;
527 The list of supported padding modes
529 RArray<TInt32> iSupportedPaddingModes;
532 The supported key mode bit map. e.g. extern key, internal key or both
534 TInt iKeySupportMode;
538 The class holds the key agreement characteristics.
539 which is used for internalization.
541 NONSHARABLE_CLASS(CKeyAgreementCharacteristics) : public CCharacteristics
547 Create a new instance of CKeyAgreementCharacteristics.
549 @return the pointer of the key agreement characteristic
551 static CKeyAgreementCharacteristics* NewL();
556 Create a new instance of CKeyAgreementCharacteristics.
557 Leave it on the cleanup stack.
559 @return the pointer of the key agreement characteristic
561 static CKeyAgreementCharacteristics* NewLC();
566 virtual ~CKeyAgreementCharacteristics();
569 Internalize this object from the supplied stream.
571 @param aStream Stream to read CKeyAgreementCharacteristics from.
573 virtual void InternalizeL(RReadStream& aStream);
579 CKeyAgreementCharacteristics();
583 The class holds the key pair generator characteristics.
584 which is used for internalization.
586 NONSHARABLE_CLASS(CKeypairGeneratorCharacteristics) : public CCharacteristics
592 Create a new instance of CKeypairGeneratorCharacteristics.
594 @return the pointer of the keypair generator characteristic
596 static CKeypairGeneratorCharacteristics* NewL();
601 Create a new instance of CKeypairGeneratorCharacteristics.
602 Leave it on the cleanup stack.
604 @return the pointer of the keypair generator characteristic
606 static CKeypairGeneratorCharacteristics* NewLC();
611 virtual ~CKeypairGeneratorCharacteristics();
614 Internalize this object from the supplied stream.
616 @param aStream Stream to read CKeyAgreementCharacteristics from.
618 virtual void InternalizeL(RReadStream& aStream);
624 CKeypairGeneratorCharacteristics();
627 The maximum key length in bits
629 TUint iMaximumKeyLength;
633 The class holds characteristics and dll index.
634 which is used for internalization.
636 NONSHARABLE_CLASS(CCharacteristicsAndPluginName) : public CBase
642 Create a new instance of CKeypairGeneratorCharacteristics.
644 @param aInterface the interface uid
645 @return the pointer of the keypair generator characteristic
647 static CCharacteristicsAndPluginName* NewL(TInt32 aInterface);
652 Create a new instance of CKeypairGeneratorCharacteristics.
653 Leave it on the cleanup stack.
655 @param aInterface the interface uid
656 @return the pointer of the keypair generator characteristic
658 static CCharacteristicsAndPluginName* NewLC(TInt32 aInterface);
663 virtual ~CCharacteristicsAndPluginName();
668 Internalize this object from the supplied stream.
670 @param aStream Stream to read CCharacteristicsAndPluginName from.
672 void InternalizeL(RReadStream& aStream);
680 CCharacteristicsAndPluginName();
681 /** @internalComponent */
682 void ConstructL(TInt32 aInterface);
686 The characteristic of the crypto implementation
688 CCharacteristics* iCharacteristic;
691 The extended characteristic of the crypto implementation
693 CExtendedCharacteristics* iExtendedCharacteristic;
696 The name of the plugin dll which contains this implementation
701 #endif //__CRYPTOCHARACTERISTICS_H__