os/security/crypto/weakcryptospi/inc/spi/plugincharacteristics.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* plugin characteristic definition
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file
sl@0
    22
 @publishedAll
sl@0
    23
 @released
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
sl@0
    27
#define __CRYPTOAPI_PLUGINCHARACTERISTICS_H__
sl@0
    28
sl@0
    29
#include <e32base.h>
sl@0
    30
#include <cryptospi/cryptoparams.h>
sl@0
    31
#include <s32mem.h>
sl@0
    32
sl@0
    33
// Forward declarations
sl@0
    34
struct TRomLitC16;
sl@0
    35
sl@0
    36
sl@0
    37
namespace CryptoSpi
sl@0
    38
	{
sl@0
    39
	const TInt32 KInterfaceType = 0x10283527;
sl@0
    40
	const TInt32 KAlgorithmType = 0x10283528;
sl@0
    41
	const TInt32 KImplementationType = 0x10283529;
sl@0
    42
	const TInt32 KCreatorNameType = 0x1028352A;
sl@0
    43
	const TInt32 KIsFIPSApprovedType = 0x1028352B;
sl@0
    44
	const TInt32 KIsHardwareSupportedType = 0x1028352C;
sl@0
    45
	const TInt32 KMaxConcurrencySupportedType = 0x1028352D;
sl@0
    46
	const TInt32 KLatencyType = 0x1028352E;
sl@0
    47
	const TInt32 KThroughputType = 0x1028352F;
sl@0
    48
	const TInt32 KBlockSizeType = 0x10283530;
sl@0
    49
	const TInt32 KOutputSizeType = 0x10283531;
sl@0
    50
	const TInt32 KSupportedOperationModesType = 0x10283532;
sl@0
    51
	const TInt32 KBlockingModeType = 0x10283533;
sl@0
    52
	const TInt32 KMaximumKeyLengthType = 0x10283534;
sl@0
    53
	const TInt32 KSupportedPaddingModesType = 0x10283535;
sl@0
    54
	const TInt32 KKeySupportModeType = 0x10283536;
sl@0
    55
	const TInt32 KConcurrencyType = 0x10283537;
sl@0
    56
	const TInt32 KExclusiveUseType = 0x10283538;
sl@0
    57
	
sl@0
    58
	/**
sl@0
    59
	The following are the characteristic UIDs which should be used for Rules-based Selector
sl@0
    60
	*/
sl@0
    61
	const TUid KNoneUid = {0x00000000};
sl@0
    62
	const TUid KInterfaceTypeUid = {KInterfaceType};
sl@0
    63
	const TUid KAlgorithmTypeUid = {KAlgorithmType};
sl@0
    64
	const TUid KImplementationTypeUid = {KImplementationType};
sl@0
    65
	const TUid KCreatorNameTypeUid = {KCreatorNameType};
sl@0
    66
	const TUid KIsFIPSApprovedTypeUid = {KIsFIPSApprovedType};
sl@0
    67
	const TUid KIsHardwareSupportedTypeUid = {KIsHardwareSupportedType};
sl@0
    68
	const TUid KMaxConcurrencySupportedTypeUid = {KMaxConcurrencySupportedType};
sl@0
    69
	const TUid KLatencyTypeUid = {KLatencyType};
sl@0
    70
	const TUid KThroughputTypeUid = {KThroughputType};
sl@0
    71
	const TUid KBlockSizeTypeUid = {KBlockSizeType};
sl@0
    72
	const TUid KOutputSizeTypeUid = {KOutputSizeType};
sl@0
    73
	const TUid KSupportedOperationModesTypeUid = {KSupportedOperationModesType};
sl@0
    74
	const TUid KBlockingModeTypeUid = {KBlockingModeType};
sl@0
    75
	const TUid KMaximumKeyLengthTypeUid = {KMaximumKeyLengthType};
sl@0
    76
	const TUid KSupportedPaddingModesTypeUid = {KSupportedPaddingModesType};
sl@0
    77
	const TUid KKeySupportModeTypeUid = {KKeySupportModeType};
sl@0
    78
	const TUid KConcurrencyTypeUid = {KConcurrencyType};
sl@0
    79
	const TUid KExclusiveUseTypeUid = {KExclusiveUseType};
sl@0
    80
sl@0
    81
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT	
sl@0
    82
	const TInt32 KMacModeType = 0x2001ED9F;
sl@0
    83
	const TUid KMacModeTypeUid = {KMacModeType};
sl@0
    84
#endif
sl@0
    85
	
sl@0
    86
	
sl@0
    87
	typedef TAny TCharacteristics;
sl@0
    88
sl@0
    89
	/**
sl@0
    90
	Common characteristics for all plug-in interface types.
sl@0
    91
sl@0
    92
	This MUST be the first element of each characteristics "sub-class" to
sl@0
    93
	allow sub-classes to be cast directly to a TCommonCharacteristics. This
sl@0
    94
	is used instead of inheritance because it enables arrays of characteristics
sl@0
    95
	objects to be defined as static constant data.
sl@0
    96
	*/ 
sl@0
    97
	class TCommonCharacteristics
sl@0
    98
		{
sl@0
    99
	public:
sl@0
   100
	
sl@0
   101
		/**
sl@0
   102
		 * @internalComponent
sl@0
   103
		 * 
sl@0
   104
		 * Externalises common characteristics to a write stream.
sl@0
   105
		 *
sl@0
   106
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   107
		 */
sl@0
   108
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   109
	
sl@0
   110
	public:
sl@0
   111
		/**
sl@0
   112
		Interface UID, e.g hash, symmetric cipher
sl@0
   113
		*/
sl@0
   114
		TInt32 iInterfaceUID;
sl@0
   115
sl@0
   116
		/**
sl@0
   117
		Algorithm UID, e.g MD2, 3DES 
sl@0
   118
		*/
sl@0
   119
		TInt32 iAlgorithmUID;
sl@0
   120
sl@0
   121
		/**
sl@0
   122
		Implementaion UID
sl@0
   123
		*/
sl@0
   124
		TInt32 iImplementationUID;
sl@0
   125
sl@0
   126
		/**
sl@0
   127
		Creator name
sl@0
   128
		*/	
sl@0
   129
		const TRomLitC16* iCreatorName;
sl@0
   130
sl@0
   131
		/**
sl@0
   132
		whether the implementation is FIPS compliant
sl@0
   133
		*/
sl@0
   134
		TBool iIsFIPSApproved;
sl@0
   135
sl@0
   136
		/**
sl@0
   137
		whether the implementation is a hardware one
sl@0
   138
		*/
sl@0
   139
		TBool iIsHardwareSupported;
sl@0
   140
sl@0
   141
		/**
sl@0
   142
		the Maximum concurrent operation supported
sl@0
   143
		*/
sl@0
   144
		TUint iMaxConcurrencySupported;
sl@0
   145
		
sl@0
   146
		/**
sl@0
   147
		the Algorithm Name
sl@0
   148
		*/
sl@0
   149
		const TRomLitC16* iAlgorithmName;
sl@0
   150
		
sl@0
   151
		/**
sl@0
   152
		The Latency
sl@0
   153
		*/
sl@0
   154
		TInt iLatency;
sl@0
   155
		
sl@0
   156
		/**
sl@0
   157
		the Throughput
sl@0
   158
		*/
sl@0
   159
		TInt iThroughput;
sl@0
   160
		};
sl@0
   161
		
sl@0
   162
	/**
sl@0
   163
	Hash Characteristics
sl@0
   164
	*/	
sl@0
   165
	class THashCharacteristics
sl@0
   166
		{
sl@0
   167
	public:
sl@0
   168
		/**
sl@0
   169
		 * @internalComponent
sl@0
   170
		 * 
sl@0
   171
		 * Externalises hash characteristics to a write stream.
sl@0
   172
		 *
sl@0
   173
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   174
		 **/	
sl@0
   175
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   176
		
sl@0
   177
		/**
sl@0
   178
		 * @deprecated
sl@0
   179
		 * 
sl@0
   180
		 * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in 
sl@0
   181
		 * by searching through iSupportedOperationModes for the UID value corresponding
sl@0
   182
		 * to the aOperationMode parameter.
sl@0
   183
		 *
sl@0
   184
		 * @param aOperationMode	The UID of the operation mode to test
sl@0
   185
		 * @return 					ETrue if the operation mode is supported; otherwise, EFalse is returned.
sl@0
   186
		 */
sl@0
   187
		IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;		
sl@0
   188
		
sl@0
   189
	public:
sl@0
   190
		/**
sl@0
   191
		Common characteristics
sl@0
   192
		*/								
sl@0
   193
		TCommonCharacteristics cmn;
sl@0
   194
sl@0
   195
		/**
sl@0
   196
		The internal block size of the hash in bits
sl@0
   197
		*/
sl@0
   198
		TUint iBlockSize;
sl@0
   199
sl@0
   200
		/**
sl@0
   201
		the output size of the hash in bits
sl@0
   202
		*/
sl@0
   203
		TUint iOutputSize;
sl@0
   204
		
sl@0
   205
		/**
sl@0
   206
		The list of supported Operation modes
sl@0
   207
		*/
sl@0
   208
		const TInt32* iSupportedOperationModes;
sl@0
   209
sl@0
   210
		/**
sl@0
   211
		Number of the supported Operation mode
sl@0
   212
		*/
sl@0
   213
		TUint iOperationModeNum;
sl@0
   214
		};
sl@0
   215
sl@0
   216
	/**
sl@0
   217
	Random Characteristics
sl@0
   218
	*/	
sl@0
   219
	class TRandomCharacteristics
sl@0
   220
		{
sl@0
   221
	public:
sl@0
   222
		/**
sl@0
   223
		 * @internalComponent
sl@0
   224
		 * 
sl@0
   225
		 * Externalises random characteristics to a write stream.
sl@0
   226
		 *
sl@0
   227
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   228
		 **/
sl@0
   229
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   230
	public:
sl@0
   231
		/**
sl@0
   232
		Common characteristics
sl@0
   233
		*/	
sl@0
   234
		TCommonCharacteristics cmn;
sl@0
   235
		
sl@0
   236
		/**
sl@0
   237
		The bit map of blocking non-blocking mode
sl@0
   238
		*/
sl@0
   239
		TUint iBlockingMode;
sl@0
   240
		};
sl@0
   241
sl@0
   242
sl@0
   243
	/**
sl@0
   244
	Symmetric Cipher Chararcteristics
sl@0
   245
	*/	
sl@0
   246
	class TSymmetricCipherCharacteristics
sl@0
   247
		{
sl@0
   248
	public:
sl@0
   249
		/**
sl@0
   250
		 * @internalComponent
sl@0
   251
		 * 
sl@0
   252
		 * Externalises symmetric cipher characteristics to a write stream.
sl@0
   253
		 *
sl@0
   254
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   255
		 **/	
sl@0
   256
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   257
		
sl@0
   258
		/**
sl@0
   259
		Determines whether an operation mode (e.g. CBC) is supported by the plug-in 
sl@0
   260
		by searching through iSupportedOperationModes for the UID value corresponding
sl@0
   261
		to the aOperationMode parameter.
sl@0
   262
		@param aOperationMode	The UID of the operation mode to test
sl@0
   263
		@return ETrue if the operation mode is supported; otherwise, EFalse is returned.
sl@0
   264
		*/
sl@0
   265
		IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const;
sl@0
   266
		
sl@0
   267
		/**
sl@0
   268
		Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in 
sl@0
   269
		by searching through iSupportedPaddingModes for the UID value corresponding
sl@0
   270
		to the aPaddingMode parameter.
sl@0
   271
		@param aPaddingMode	The UID of the padding mode to test.
sl@0
   272
		@return ETrue if the padding mode is supported; otherwise, EFalse is returned.
sl@0
   273
		*/
sl@0
   274
		IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
sl@0
   275
	
sl@0
   276
	public:
sl@0
   277
		/**
sl@0
   278
		Common characteristics
sl@0
   279
		*/	
sl@0
   280
		TCommonCharacteristics cmn;
sl@0
   281
	
sl@0
   282
		/**
sl@0
   283
		The maximum key length in bits
sl@0
   284
		*/
sl@0
   285
		TUint iMaximumKeyLength;
sl@0
   286
sl@0
   287
		/**
sl@0
   288
		The block size of the cipher in bits
sl@0
   289
		*/
sl@0
   290
		TUint iBlockSize;
sl@0
   291
sl@0
   292
		/**
sl@0
   293
		The list of supported padding modes
sl@0
   294
		*/
sl@0
   295
		const TInt32* iSupportedPaddingModes;
sl@0
   296
		
sl@0
   297
		/**
sl@0
   298
		Number of the supported padding mode
sl@0
   299
		*/
sl@0
   300
		TUint iPaddingModeNum;		
sl@0
   301
sl@0
   302
		/**
sl@0
   303
		The list of supported Operation modes
sl@0
   304
		*/
sl@0
   305
		const TInt32* iSupportedOperationModes;
sl@0
   306
sl@0
   307
		/**
sl@0
   308
		Number of the supported Operation mode
sl@0
   309
		*/
sl@0
   310
		TUint iOperationModeNum;
sl@0
   311
		
sl@0
   312
		/**
sl@0
   313
		The supported key mode bit map. e.g. extern key, internal key or both
sl@0
   314
		*/
sl@0
   315
		TInt iKeySupportMode;				
sl@0
   316
		};
sl@0
   317
sl@0
   318
	/**
sl@0
   319
	Asymmetric Cipher Characteristics
sl@0
   320
	*/	
sl@0
   321
	class TAsymmetricCipherCharacteristics
sl@0
   322
		{
sl@0
   323
	public:
sl@0
   324
		/**
sl@0
   325
		 * @internalComponent
sl@0
   326
		 * 
sl@0
   327
		 * Externalises asymmetric cipher characteristics to a write stream.
sl@0
   328
		 *
sl@0
   329
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   330
		 **/
sl@0
   331
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   332
		
sl@0
   333
		/**
sl@0
   334
		Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in 
sl@0
   335
		by searching through iSupportedPaddingModes for the UID value corresponding
sl@0
   336
		to the aPaddingMode parameter.
sl@0
   337
		@param aPaddingMode	The UID of the padding mode to test.
sl@0
   338
		@return ETrue if the padding mode is supported; otherwise, EFalse is returned.
sl@0
   339
		*/
sl@0
   340
		IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
sl@0
   341
		
sl@0
   342
	public:
sl@0
   343
		/**
sl@0
   344
		Common characteristics
sl@0
   345
		*/	
sl@0
   346
		TCommonCharacteristics cmn;
sl@0
   347
		/**
sl@0
   348
		The maximum key length in bits
sl@0
   349
		*/
sl@0
   350
		TUint iMaximumKeyLength;
sl@0
   351
	
sl@0
   352
		/**
sl@0
   353
		The list of supported padding modes
sl@0
   354
		*/
sl@0
   355
		const TInt32* iSupportedPaddingModes;
sl@0
   356
		
sl@0
   357
		/**
sl@0
   358
		Number of the supported padding mode
sl@0
   359
		*/
sl@0
   360
		TInt iPaddingModeNum;
sl@0
   361
		
sl@0
   362
		/**
sl@0
   363
		The supported key mode bit map. e.g. extern key, internal key or both
sl@0
   364
		*/
sl@0
   365
		TInt iKeySupportMode;		
sl@0
   366
		};
sl@0
   367
sl@0
   368
	/**
sl@0
   369
	Signature Characteristics
sl@0
   370
	*/	
sl@0
   371
	class TAsymmetricSignatureCharacteristics
sl@0
   372
		{
sl@0
   373
	public:
sl@0
   374
		/**
sl@0
   375
		 * @internalComponent
sl@0
   376
		 *
sl@0
   377
		 * Externalises signature characteristics to a write stream.
sl@0
   378
		 *
sl@0
   379
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   380
		 **/
sl@0
   381
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   382
		
sl@0
   383
		/**
sl@0
   384
		Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in 
sl@0
   385
		by searching through iSupportedPaddingModes for the UID value corresponding
sl@0
   386
		to the aPaddingMode parameter.
sl@0
   387
		@param aPaddingMode	The UID of the padding mode to test.
sl@0
   388
		@return ETrue if the padding mode is supported; otherwise, EFalse is returned.
sl@0
   389
		*/
sl@0
   390
		IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const;
sl@0
   391
		
sl@0
   392
	public:
sl@0
   393
		/**
sl@0
   394
		Common characteristics
sl@0
   395
		*/	
sl@0
   396
		TCommonCharacteristics cmn;
sl@0
   397
sl@0
   398
		/**
sl@0
   399
		The maximum key length in bits
sl@0
   400
		*/
sl@0
   401
		TUint iMaximumKeyLength;
sl@0
   402
	
sl@0
   403
		/**
sl@0
   404
		The list of supported padding modes
sl@0
   405
		*/
sl@0
   406
		const TInt32* iSupportedPaddingModes;
sl@0
   407
		
sl@0
   408
		/**
sl@0
   409
		Number of the supported padding mode
sl@0
   410
		*/
sl@0
   411
		TInt iPaddingModeNum;
sl@0
   412
	
sl@0
   413
		/**
sl@0
   414
		The supported key mode bit map. e.g. extern key, internal key or both
sl@0
   415
		*/
sl@0
   416
		TInt iKeySupportMode;		
sl@0
   417
		};
sl@0
   418
sl@0
   419
sl@0
   420
	/**
sl@0
   421
	Key Agreement Characteristics
sl@0
   422
	*/	
sl@0
   423
	class TKeyAgreementCharacteristics
sl@0
   424
		{
sl@0
   425
	public:
sl@0
   426
		/**
sl@0
   427
		 * @internalComponent
sl@0
   428
		 * 
sl@0
   429
		 * Externalises key agreement characteristics to a write stream.
sl@0
   430
		 *
sl@0
   431
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   432
		 **/	
sl@0
   433
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   434
		
sl@0
   435
	public:
sl@0
   436
		/**
sl@0
   437
		Common characteristics
sl@0
   438
		*/	
sl@0
   439
		TCommonCharacteristics cmn;
sl@0
   440
		};
sl@0
   441
		
sl@0
   442
	/**
sl@0
   443
	Asymmetric Keypair Generator Characteristics
sl@0
   444
	*/	
sl@0
   445
	class TAsymmetricKeypairGeneratorCharacteristics 
sl@0
   446
		{
sl@0
   447
	public:
sl@0
   448
		/**
sl@0
   449
		 * @internalComponent
sl@0
   450
		 * 
sl@0
   451
		 * Externalises key pair generator characteristics to a write stream.
sl@0
   452
		 *
sl@0
   453
		 * @param aStream	Stream to which the object should be externalised.
sl@0
   454
		 **/
sl@0
   455
		void ExternalizeL(RWriteStream& aStream) const;
sl@0
   456
		
sl@0
   457
	public:
sl@0
   458
		/**
sl@0
   459
		Common characteristics
sl@0
   460
		*/	
sl@0
   461
		TCommonCharacteristics cmn;
sl@0
   462
sl@0
   463
		/**
sl@0
   464
		The maximum key length that may be generarted in bits
sl@0
   465
		*/
sl@0
   466
		TUint iMaximumKeyLength;		
sl@0
   467
		};
sl@0
   468
sl@0
   469
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT		
sl@0
   470
	/**
sl@0
   471
	 * Mac Characteristics
sl@0
   472
	 */	
sl@0
   473
	class TMacCharacteristics
sl@0
   474
		{
sl@0
   475
	public:
sl@0
   476
		/**
sl@0
   477
		 * @internalComponent
sl@0
   478
		 * 
sl@0
   479
		 * Externalises hash characteristics to a write stream.
sl@0
   480
		 *
sl@0
   481
		 * @param aStream Stream to which the object should be externalised.
sl@0
   482
		 */	
sl@0
   483
	    void ExternalizeL(RWriteStream& aStream) const;
sl@0
   484
			
sl@0
   485
	public:
sl@0
   486
	
sl@0
   487
		/**
sl@0
   488
		 * Common Characteristics
sl@0
   489
		 */
sl@0
   490
		TCommonCharacteristics iMacChar;  
sl@0
   491
			
sl@0
   492
		/**
sl@0
   493
		 * Mac Mode Type UID will be used to select the plug-in implementations. 
sl@0
   494
		 * The mode can be either hash or symmetric cipher based. 
sl@0
   495
		 */
sl@0
   496
		TInt32 iMacMode;
sl@0
   497
sl@0
   498
		/**
sl@0
   499
		 * The following pointers are mutually exclusive in their usage and anytime 
sl@0
   500
		 * only one will be initialised depending upon the Mac mode type the plug-in
sl@0
   501
         * supports, those not supported will be NULL.               
sl@0
   502
         */    
sl@0
   503
sl@0
   504
		/**
sl@0
   505
		 * Initialised if 'iMacMode' is Hash based otherwise will be NULL.
sl@0
   506
		 */
sl@0
   507
		const THashCharacteristics* iHashAlgorithmChar;
sl@0
   508
		/**
sl@0
   509
		 * Initialised if 'iMacMode' is Symmetric Cipher based otherwise will be NULL.
sl@0
   510
		 */
sl@0
   511
		const TSymmetricCipherCharacteristics* iCipherAlgorithmChar;
sl@0
   512
		};
sl@0
   513
#endif	
sl@0
   514
	}
sl@0
   515
#endif //__CRYPTOAPI_PLUGINCHARACTERISTICS_H__