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 * crypto parameters interface
26 #ifndef __CRYPTOPARAMS_H__
27 #define __CRYPTOPARAMS_H__
34 Abstract base class for generic crypto parameters to enable plug-in
35 specific parameters and the externalisation of plug-ins. The type
36 of the sub-class is identified by the GetType method.
38 All sub-class contain copies of (instead of references to) the
41 NONSHARABLE_CLASS(CCryptoParam) : public CBase
46 The definition of the data type of the embedded value.
47 Other data types may be added in future so applications
48 should not panic if the type is not recognised.
71 Returns the data type of the crypto parameter
72 @return The data type of the crypto parameter
74 IMPORT_C TInt Type() const;
77 Returns the Uid of the crypto parameter
78 @return The Uid of the crypto parameter
80 IMPORT_C TUid Uid() const;
85 IMPORT_C ~CCryptoParam();
92 * @param aType The data type identifier for the sub-class.
93 * @param aUid The Uid of the cryptoparam
95 CCryptoParam(TParamType aType, TUid aUid);
99 The data type of the embedded value
104 The Uid of the crypto parameter
110 CryptoParam class that wraps a TInt
112 NONSHARABLE_CLASS(CCryptoIntParam) : public CCryptoParam
116 Factory method for allocating a new CCryptoIntParam object
117 that contains a copy of the supplied TInt
118 @param aValue The TInt to be wrapped (copied)
119 @param aUid The UID of the CryptoParam
120 @return A pointer to a CCryptoIntParam instance
122 IMPORT_C static CCryptoIntParam* NewL(TInt aValue, TUid aUid);
125 Factory method for allocating a new CCryptoIntParam object
126 that contains a copy of the supplied TInt
127 Leaves the pointer of the CryptoParam on the cleanup stack
128 @param aValue The TInt to be wrapped (copied)
129 @param aUid The UID of the CryptoParam
130 @return A pointer to a CCryptoIntParam instance
132 IMPORT_C static CCryptoIntParam* NewLC(TInt aValue, TUid aUid);
135 Returns the embedded value.
136 @return The embedded integer
138 IMPORT_C TInt Value() const;
143 IMPORT_C ~CCryptoIntParam();
148 @param aValue The integer to wrap
149 @param aUid The UID of the crypto parameter
151 CCryptoIntParam(TInt aValue, TUid aUid);
161 Crypto param class the wraps an RInteger
163 NONSHARABLE_CLASS(CCryptoBigIntParam) : public CCryptoParam
167 Factory method for allocating a new CCryptoBigIntParam object
168 that contains a copy of the supplied TInteger object.
169 @param aValue The TInteger to be wrapped (copied)
170 @param aUid The UID of the CryptoParam
171 @return A pointer to a CCryptoBigIntParam instance
173 IMPORT_C static CCryptoBigIntParam* NewL(const TInteger& aValue, TUid aUid);
176 Factory method for allocating a new CCryptoBigIntParam object
177 that contains a copy of the supplied TInteger object.
178 Leaves the pointer of the CryptoParam onto the cleanup stack.
179 @param aValue The TInteger to be wrapped (copied)
180 @param aUid The UID of the CryptoParam
181 @return A pointer to a CCryptoBigIntParam instance
183 IMPORT_C static CCryptoBigIntParam* NewLC(const TInteger& aValue, TUid aUid);
186 Returns the embedded value.
187 @return A reference to the embedded TInteger
189 IMPORT_C const TInteger& Value() const;
194 IMPORT_C ~CCryptoBigIntParam();
200 CCryptoBigIntParam();
204 @param aUid The UID of the crypto parameter
206 CCryptoBigIntParam(TUid aUid);
209 Second Phase Constructor
210 @param aValue The TInteger to wrap
212 void ConstructL(const TInteger& aValue);
222 Crypto param class that wraps an 8-bit constant descriptor
224 NONSHARABLE_CLASS(CCryptoDesC8Param) : public CCryptoParam
228 Factory method for allocating a new CCryptoDesC8Param object
229 that contains a copy of the supplied RInteger object.
230 @param aValue The TDesC* to be wrapped (copied)
231 @param aUid The Uid of the CryptoParam
232 @return A pointer to a CCryptoDesC8Param instance
234 IMPORT_C static CCryptoDesC8Param* NewL(const TDesC8& aValue, TUid aUid);
237 Factory method for allocating a new CCryptoDesC8Param object
238 that contains a copy of the supplied RInteger object.
239 Leaves the pointer of the CryptoParam on the cleanup stack
240 @param aValue The TDesC* to be wrapped (copied)
241 @param aUid The Uid of the CryptoParam
242 @return A pointer to a CCryptoDesC8Param instance
244 IMPORT_C static CCryptoDesC8Param* NewLC(const TDesC8& aValue, TUid aUid);
247 Returns the embedded value.
248 @return A reference to the embedded TDesC8
250 IMPORT_C const TDesC8& Value() const;
255 IMPORT_C ~CCryptoDesC8Param();
265 @param aUid The UID of the crypto parameter
267 CCryptoDesC8Param(TUid aUid);
270 Second Phase Constructor
271 @param aValue The DesC8 to wrap
273 void ConstructL(const TDesC8& aValue);
277 The copied descriptor
283 Crypto param class that wraps an 16-bit constant descriptor
285 NONSHARABLE_CLASS(CCryptoDesC16Param) : public CCryptoParam
289 Factory method for allocating a new CCryptoDesC8Param object
290 that contains a copy of the supplied RInteger object.
291 @param aValue The TDesC* to be wrapped (copied)
292 @param aUid The Uid of the CryptoParam
293 @return A pointer to a CCryptoDesC8Param instance
295 IMPORT_C static CCryptoDesC16Param* NewL(const TDesC16& aValue, TUid aUid);
298 Factory method for allocating a new CCryptoDesC16Param object
299 that contains a copy of the supplied RInteger object.
300 Leaves the pointer of the CryptoParam on the cleanup stack
301 @param aValue The TDesC* to be wrapped (copied)
302 @param aUid The Uid of the CryptoParam
303 @return A pointer to a CCryptoDesC16Param instance
305 IMPORT_C static CCryptoDesC16Param* NewLC(const TDesC16& aValue, TUid aUid);
308 Returns the embedded value.
309 @return A reference to the embedded TDesC16
311 IMPORT_C const TDesC16& Value() const;
316 IMPORT_C ~CCryptoDesC16Param();
322 CCryptoDesC16Param();
326 @param aUid The UID of the crypto parameter
328 CCryptoDesC16Param(TUid aUid);
331 Second Phase Constructor
332 @param aValue The DesC16 to wrap
334 void ConstructL(const TDesC16& aValue);
338 The copied descriptor
343 NONSHARABLE_CLASS(CCryptoParams) : public CBase
346 IMPORT_C static CCryptoParams* NewL(void);
347 IMPORT_C static CCryptoParams* NewLC(void);
350 * Various adding methods (CCryptoParams takes a copy)
352 IMPORT_C void AddL(const TInteger& aParam, TUid aUid);
353 IMPORT_C void AddL(const TInt aParam, TUid aUid);
354 IMPORT_C void AddL(const TDesC8& aParam, TUid aUid);
355 IMPORT_C void AddL(const TDesC16& aParam, TUid aUid);
358 * Various retrieving methods
360 IMPORT_C const TInteger& GetBigIntL(TUid aUid) const;
361 IMPORT_C TInt GetTIntL(TUid aUid) const;
362 IMPORT_C const TDesC8& GetTDesC8L(TUid aUid) const;
363 IMPORT_C const TDesC16& GetTDesC16L(TUid aUid) const;
364 IMPORT_C const RPointerArray<CCryptoParam>& GetParams() const;
366 /// Queries if a parameter with the specified uid is present
367 IMPORT_C TBool IsPresent(TUid aUid) const;
369 /// Return the count of parameters present
370 IMPORT_C TInt Count(void) const;
372 /// Copy the passed CCryptoParams
373 IMPORT_C CCryptoParams& CopyL(const CCryptoParams& aParams);
376 IMPORT_C virtual ~CCryptoParams();
379 /** @internalComponent */
382 /** @internalComponent */
383 void ConstructL(void);
384 /** @internalComponent */
385 CCryptoParam* GetCryptoParam(TUid aUid) const;
386 /** @internalComponent */
387 CCryptoParam* GetCryptoParamL(TUid aUid) const;
390 RPointerArray<CCryptoParam> iParams;
394 #endif // __CRYPTOPARAMS_H__