epoc32/include/cryptospi/cryptoparams.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description: 
williamr@4
    15
* crypto parameters interface
williamr@4
    16
*
williamr@4
    17
*/
williamr@4
    18
williamr@4
    19
williamr@4
    20
/**
williamr@4
    21
 @file
williamr@4
    22
 @publishedAll
williamr@4
    23
 @released 
williamr@4
    24
*/
williamr@4
    25
williamr@4
    26
#ifndef __CRYPTOPARAMS_H__
williamr@4
    27
#define __CRYPTOPARAMS_H__
williamr@4
    28
williamr@4
    29
#include <bigint.h>
williamr@4
    30
williamr@4
    31
namespace CryptoSpi
williamr@4
    32
	{
williamr@4
    33
	/**
williamr@4
    34
	Abstract base class for generic crypto parameters to enable plug-in 
williamr@4
    35
	specific parameters and the externalisation of plug-ins. The type
williamr@4
    36
	of the sub-class is identified by the GetType method.
williamr@4
    37
williamr@4
    38
	All sub-class contain copies of (instead of references to) the 
williamr@4
    39
	supplied values.
williamr@4
    40
	*/
williamr@4
    41
	NONSHARABLE_CLASS(CCryptoParam) : public CBase
williamr@4
    42
		{
williamr@4
    43
	public:
williamr@4
    44
williamr@4
    45
		/**
williamr@4
    46
		The definition of the data type of the embedded value. 
williamr@4
    47
		Other data types may be added in future so applications 
williamr@4
    48
		should not panic if the type is not recognised.
williamr@4
    49
		*/
williamr@4
    50
		enum TParamType
williamr@4
    51
			{
williamr@4
    52
			/** 
williamr@4
    53
			RCryptoIntParam 
williamr@4
    54
			*/
williamr@4
    55
			EInt = 1,
williamr@4
    56
			/** 
williamr@4
    57
			RCryptoBigIntParam 
williamr@4
    58
			*/
williamr@4
    59
			EBigInt = 2,
williamr@4
    60
			/** 
williamr@4
    61
			RCryptoDesC8Param 
williamr@4
    62
			*/
williamr@4
    63
			EDesC8 = 3,
williamr@4
    64
			/** 
williamr@4
    65
			RCryptoDesC16Param 
williamr@4
    66
			*/
williamr@4
    67
			EDesC16 = 4,
williamr@4
    68
			};
williamr@4
    69
				
williamr@4
    70
		/**
williamr@4
    71
		Returns the data type of the crypto parameter
williamr@4
    72
		@return The data type of the crypto parameter
williamr@4
    73
		*/
williamr@4
    74
		IMPORT_C TInt Type() const;
williamr@4
    75
		
williamr@4
    76
		/**
williamr@4
    77
		Returns the Uid of the crypto parameter
williamr@4
    78
		@return The Uid of the crypto parameter
williamr@4
    79
		*/
williamr@4
    80
		IMPORT_C TUid Uid() const;
williamr@4
    81
		
williamr@4
    82
		/** 
williamr@4
    83
		Destructor 
williamr@4
    84
		*/
williamr@4
    85
		IMPORT_C ~CCryptoParam();
williamr@4
    86
		
williamr@4
    87
	protected:
williamr@4
    88
		/**
williamr@4
    89
		 * @internalComponent
williamr@4
    90
		 * 
williamr@4
    91
		 * Constructor 
williamr@4
    92
		 * @param aType	The data type identifier for the sub-class.
williamr@4
    93
		 * @param aUid	The Uid of the cryptoparam
williamr@4
    94
		 */
williamr@4
    95
		CCryptoParam(TParamType aType, TUid aUid);
williamr@4
    96
williamr@4
    97
	protected:
williamr@4
    98
		/**
williamr@4
    99
		The data type of the embedded value
williamr@4
   100
		*/
williamr@4
   101
		TParamType iType;
williamr@4
   102
		
williamr@4
   103
		/**
williamr@4
   104
		The Uid of the crypto parameter
williamr@4
   105
		*/
williamr@4
   106
		TUid iUid;
williamr@4
   107
		};
williamr@4
   108
williamr@4
   109
	/**
williamr@4
   110
	CryptoParam class that wraps a TInt
williamr@4
   111
	*/
williamr@4
   112
	NONSHARABLE_CLASS(CCryptoIntParam) : public CCryptoParam
williamr@4
   113
		{
williamr@4
   114
	public: 
williamr@4
   115
		/**
williamr@4
   116
		Factory method for allocating a new CCryptoIntParam object
williamr@4
   117
		that contains a copy of the supplied TInt
williamr@4
   118
		@param aValue The TInt to be wrapped (copied)
williamr@4
   119
		@param aUid The UID of the CryptoParam
williamr@4
   120
		@return A pointer to a CCryptoIntParam instance
williamr@4
   121
		*/
williamr@4
   122
		IMPORT_C static CCryptoIntParam* NewL(TInt aValue, TUid aUid);
williamr@4
   123
williamr@4
   124
		/**
williamr@4
   125
		Factory method for allocating a new CCryptoIntParam object
williamr@4
   126
		that contains a copy of the supplied TInt
williamr@4
   127
		Leaves the pointer of the CryptoParam on the cleanup stack
williamr@4
   128
		@param aValue The TInt to be wrapped (copied)
williamr@4
   129
		@param aUid The UID of the CryptoParam
williamr@4
   130
		@return A pointer to a CCryptoIntParam instance
williamr@4
   131
		*/
williamr@4
   132
		IMPORT_C static CCryptoIntParam* NewLC(TInt aValue, TUid aUid);
williamr@4
   133
williamr@4
   134
		/**
williamr@4
   135
		Returns the embedded value.
williamr@4
   136
		@return The embedded integer
williamr@4
   137
		*/
williamr@4
   138
		IMPORT_C TInt Value() const;
williamr@4
   139
williamr@4
   140
		/**
williamr@4
   141
		Destructor
williamr@4
   142
		*/
williamr@4
   143
		IMPORT_C ~CCryptoIntParam();
williamr@4
   144
		
williamr@4
   145
	private:
williamr@4
   146
		/**
williamr@4
   147
		Constructor
williamr@4
   148
		@param aValue The integer to wrap
williamr@4
   149
		@param aUid	The UID of the crypto parameter
williamr@4
   150
		*/		
williamr@4
   151
		CCryptoIntParam(TInt aValue, TUid aUid);
williamr@4
   152
williamr@4
   153
	private:
williamr@4
   154
		/** 
williamr@4
   155
		The embedded value 
williamr@4
   156
		*/
williamr@4
   157
		TInt iValue;
williamr@4
   158
		};
williamr@4
   159
williamr@4
   160
	/**
williamr@4
   161
	Crypto param class the wraps an RInteger
williamr@4
   162
	 */
williamr@4
   163
	NONSHARABLE_CLASS(CCryptoBigIntParam) : public CCryptoParam
williamr@4
   164
		{
williamr@4
   165
	public: 
williamr@4
   166
		/**
williamr@4
   167
		Factory method for allocating a new CCryptoBigIntParam object
williamr@4
   168
		that contains a copy of the supplied TInteger object.
williamr@4
   169
		@param aValue	The TInteger to be wrapped (copied)
williamr@4
   170
		@param aUid	The UID of the CryptoParam
williamr@4
   171
		@return A pointer to a CCryptoBigIntParam instance
williamr@4
   172
		*/
williamr@4
   173
		IMPORT_C static CCryptoBigIntParam* NewL(const TInteger& aValue, TUid aUid);
williamr@4
   174
		
williamr@4
   175
		/**
williamr@4
   176
		Factory method for allocating a new CCryptoBigIntParam object
williamr@4
   177
		that contains a copy of the supplied TInteger object.
williamr@4
   178
		Leaves the pointer of the CryptoParam onto the cleanup stack.
williamr@4
   179
		@param aValue	The TInteger to be wrapped (copied)
williamr@4
   180
		@param aUid	The UID of the CryptoParam
williamr@4
   181
		@return A pointer to a CCryptoBigIntParam instance
williamr@4
   182
		*/		
williamr@4
   183
		IMPORT_C static CCryptoBigIntParam* NewLC(const TInteger& aValue, TUid aUid);
williamr@4
   184
williamr@4
   185
		/**
williamr@4
   186
		Returns the embedded value.
williamr@4
   187
		@return A reference to the embedded TInteger
williamr@4
   188
		*/
williamr@4
   189
		IMPORT_C const TInteger& Value() const;
williamr@4
   190
williamr@4
   191
		/** 
williamr@4
   192
		Destructor 
williamr@4
   193
		*/
williamr@4
   194
		IMPORT_C ~CCryptoBigIntParam();
williamr@4
   195
		
williamr@4
   196
	private:
williamr@4
   197
		/**
williamr@4
   198
		Constructor
williamr@4
   199
		*/
williamr@4
   200
		CCryptoBigIntParam();
williamr@4
   201
		
williamr@4
   202
		/**
williamr@4
   203
		Constructor
williamr@4
   204
		@param aUid	The UID of the crypto parameter
williamr@4
   205
		*/				
williamr@4
   206
		CCryptoBigIntParam(TUid aUid);
williamr@4
   207
		
williamr@4
   208
		/**
williamr@4
   209
		Second Phase Constructor
williamr@4
   210
		@param aValue	The TInteger to wrap
williamr@4
   211
		*/		
williamr@4
   212
		void ConstructL(const TInteger& aValue);
williamr@4
   213
	
williamr@4
   214
	private:
williamr@4
   215
		/**
williamr@4
   216
		The copied RInteger
williamr@4
   217
		*/
williamr@4
   218
		RInteger iValue;
williamr@4
   219
		};
williamr@4
   220
	
williamr@4
   221
	/**
williamr@4
   222
	Crypto param class that wraps an 8-bit constant descriptor
williamr@4
   223
	*/
williamr@4
   224
	NONSHARABLE_CLASS(CCryptoDesC8Param) : public CCryptoParam
williamr@4
   225
		{
williamr@4
   226
	public:
williamr@4
   227
		/**
williamr@4
   228
		Factory method for allocating a new CCryptoDesC8Param object
williamr@4
   229
		that contains a copy of the supplied RInteger object.
williamr@4
   230
		@param aValue The TDesC* to be wrapped (copied)
williamr@4
   231
		@param aUid	The Uid of the CryptoParam
williamr@4
   232
		@return A pointer to a CCryptoDesC8Param instance
williamr@4
   233
		*/
williamr@4
   234
		IMPORT_C static CCryptoDesC8Param* NewL(const TDesC8& aValue, TUid aUid);
williamr@4
   235
williamr@4
   236
		/**
williamr@4
   237
		Factory method for allocating a new CCryptoDesC8Param object
williamr@4
   238
		that contains a copy of the supplied RInteger object.
williamr@4
   239
		Leaves the pointer of the CryptoParam on the cleanup stack
williamr@4
   240
		@param aValue The TDesC* to be wrapped (copied)
williamr@4
   241
		@param aUid	The Uid of the CryptoParam
williamr@4
   242
		@return A pointer to a CCryptoDesC8Param instance
williamr@4
   243
		*/
williamr@4
   244
		IMPORT_C static CCryptoDesC8Param* NewLC(const TDesC8& aValue, TUid aUid);
williamr@4
   245
williamr@4
   246
		/**
williamr@4
   247
		Returns the embedded value.
williamr@4
   248
		@return A reference to the embedded TDesC8
williamr@4
   249
		*/
williamr@4
   250
		IMPORT_C const TDesC8& Value() const;
williamr@4
   251
williamr@4
   252
		/**
williamr@4
   253
		Destructor
williamr@4
   254
		*/
williamr@4
   255
		IMPORT_C ~CCryptoDesC8Param();
williamr@4
   256
		
williamr@4
   257
	private:
williamr@4
   258
		/**
williamr@4
   259
		Constructor
williamr@4
   260
		*/
williamr@4
   261
		CCryptoDesC8Param();
williamr@4
   262
		
williamr@4
   263
		/**
williamr@4
   264
		Constructor
williamr@4
   265
		@param aUid	The UID of the crypto parameter
williamr@4
   266
		*/						
williamr@4
   267
		CCryptoDesC8Param(TUid aUid);
williamr@4
   268
williamr@4
   269
		/**
williamr@4
   270
		Second Phase Constructor
williamr@4
   271
		@param aValue The DesC8 to wrap
williamr@4
   272
		*/				
williamr@4
   273
		void ConstructL(const TDesC8& aValue);
williamr@4
   274
	
williamr@4
   275
	private:
williamr@4
   276
		/**
williamr@4
   277
		The copied descriptor
williamr@4
   278
		*/		
williamr@4
   279
		HBufC8* iValue;
williamr@4
   280
		};
williamr@4
   281
williamr@4
   282
	/**
williamr@4
   283
	Crypto param class that wraps an 16-bit constant descriptor
williamr@4
   284
	*/
williamr@4
   285
	NONSHARABLE_CLASS(CCryptoDesC16Param) : public CCryptoParam
williamr@4
   286
		{
williamr@4
   287
	public:
williamr@4
   288
		/**
williamr@4
   289
		Factory method for allocating a new CCryptoDesC8Param object
williamr@4
   290
		that contains a copy of the supplied RInteger object.
williamr@4
   291
		@param aValue The TDesC* to be wrapped (copied)
williamr@4
   292
		@param aUid	The Uid of the CryptoParam
williamr@4
   293
		@return A pointer to a CCryptoDesC8Param instance
williamr@4
   294
		*/
williamr@4
   295
		IMPORT_C static CCryptoDesC16Param* NewL(const TDesC16& aValue, TUid aUid);
williamr@4
   296
williamr@4
   297
		/**
williamr@4
   298
		Factory method for allocating a new CCryptoDesC16Param object
williamr@4
   299
		that contains a copy of the supplied RInteger object.
williamr@4
   300
		Leaves the pointer of the CryptoParam on the cleanup stack
williamr@4
   301
		@param aValue The TDesC* to be wrapped (copied)
williamr@4
   302
		@param aUid	The Uid of the CryptoParam
williamr@4
   303
		@return A pointer to a CCryptoDesC16Param instance
williamr@4
   304
		*/
williamr@4
   305
		IMPORT_C static CCryptoDesC16Param* NewLC(const TDesC16& aValue, TUid aUid);
williamr@4
   306
williamr@4
   307
		/**
williamr@4
   308
		Returns the embedded value.
williamr@4
   309
		@return A reference to the embedded TDesC16
williamr@4
   310
		*/
williamr@4
   311
		IMPORT_C const TDesC16& Value() const;
williamr@4
   312
williamr@4
   313
		/**
williamr@4
   314
		Destructor
williamr@4
   315
		*/
williamr@4
   316
		IMPORT_C ~CCryptoDesC16Param();
williamr@4
   317
		
williamr@4
   318
	private:
williamr@4
   319
		/**
williamr@4
   320
		Constructor
williamr@4
   321
		*/
williamr@4
   322
		CCryptoDesC16Param();
williamr@4
   323
		
williamr@4
   324
		/**
williamr@4
   325
		Constructor
williamr@4
   326
		@param aUid	The UID of the crypto parameter
williamr@4
   327
		*/						
williamr@4
   328
		CCryptoDesC16Param(TUid aUid);
williamr@4
   329
williamr@4
   330
		/**
williamr@4
   331
		Second Phase Constructor
williamr@4
   332
		@param aValue The DesC16 to wrap
williamr@4
   333
		*/				
williamr@4
   334
		void ConstructL(const TDesC16& aValue);
williamr@4
   335
	
williamr@4
   336
	private:
williamr@4
   337
		/**
williamr@4
   338
		The copied descriptor
williamr@4
   339
		*/		
williamr@4
   340
		HBufC16* iValue;
williamr@4
   341
		};
williamr@4
   342
		
williamr@4
   343
	NONSHARABLE_CLASS(CCryptoParams) : public CBase
williamr@4
   344
		{
williamr@4
   345
	public:
williamr@4
   346
		IMPORT_C static CCryptoParams* NewL(void);
williamr@4
   347
		IMPORT_C static CCryptoParams* NewLC(void);
williamr@4
   348
williamr@4
   349
		/**
williamr@4
   350
		 * Various adding methods (CCryptoParams takes a copy)
williamr@4
   351
		 */		
williamr@4
   352
		IMPORT_C void AddL(const TInteger& aParam, TUid aUid);
williamr@4
   353
		IMPORT_C void AddL(const TInt aParam, TUid aUid);
williamr@4
   354
		IMPORT_C void AddL(const TDesC8& aParam, TUid aUid);
williamr@4
   355
		IMPORT_C void AddL(const TDesC16& aParam, TUid aUid);
williamr@4
   356
williamr@4
   357
		/**
williamr@4
   358
		 * Various retrieving methods
williamr@4
   359
		 */
williamr@4
   360
		IMPORT_C const TInteger& GetBigIntL(TUid aUid) const;
williamr@4
   361
		IMPORT_C TInt GetTIntL(TUid aUid) const;
williamr@4
   362
		IMPORT_C const TDesC8& GetTDesC8L(TUid aUid) const;
williamr@4
   363
		IMPORT_C const TDesC16& GetTDesC16L(TUid aUid) const;
williamr@4
   364
		IMPORT_C const RPointerArray<CCryptoParam>& GetParams() const;
williamr@4
   365
williamr@4
   366
		/// Queries if a parameter with the specified uid is present
williamr@4
   367
		IMPORT_C TBool IsPresent(TUid aUid) const;
williamr@4
   368
williamr@4
   369
		/// Return the count of parameters present
williamr@4
   370
		IMPORT_C TInt Count(void) const;
williamr@4
   371
williamr@4
   372
		/// Copy the passed CCryptoParams
williamr@4
   373
		IMPORT_C CCryptoParams& CopyL(const CCryptoParams& aParams);
williamr@4
   374
williamr@4
   375
		/// Destructor
williamr@4
   376
		IMPORT_C virtual ~CCryptoParams();
williamr@4
   377
williamr@4
   378
	protected:
williamr@4
   379
		/** @internalComponent */
williamr@4
   380
		CCryptoParams();
williamr@4
   381
williamr@4
   382
		/** @internalComponent */
williamr@4
   383
		void ConstructL(void);
williamr@4
   384
		/** @internalComponent */
williamr@4
   385
		CCryptoParam* GetCryptoParam(TUid aUid) const;
williamr@4
   386
		/** @internalComponent */ 
williamr@4
   387
		CCryptoParam* GetCryptoParamL(TUid aUid) const;
williamr@4
   388
williamr@4
   389
	private:
williamr@4
   390
		RPointerArray<CCryptoParam> iParams;
williamr@4
   391
		};
williamr@4
   392
	} //End of namespace
williamr@4
   393
williamr@4
   394
#endif // __CRYPTOPARAMS_H__
williamr@4
   395