sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2002-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 |
* ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the
|
sl@0
|
16 |
* Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted.
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
@publishedPartner
|
sl@0
|
24 |
@released
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef __PBEDATA_H__
|
sl@0
|
28 |
#define __PBEDATA_H__
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <s32strm.h>
|
sl@0
|
31 |
#include <pbe.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
* Contains the Password Based Encryption parameters.
|
sl@0
|
35 |
* An object of this class can be input for CPBEncryptElement or CPBEncryptSet objects.
|
sl@0
|
36 |
*
|
sl@0
|
37 |
* @since v7.0s
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
class CPBEncryptParms : public CBase
|
sl@0
|
40 |
{
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
enum TKdf
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
Key derivation function.
|
sl@0
|
45 |
This does not affect the authentication key,
|
sl@0
|
46 |
which always uses PKCS#5.
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
{
|
sl@0
|
49 |
EKdfPkcs5,
|
sl@0
|
50 |
EKdfPkcs12
|
sl@0
|
51 |
};
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
* Creates a new CPBEncryptParms object.
|
sl@0
|
55 |
*
|
sl@0
|
56 |
* @param aCipher The cipher to use
|
sl@0
|
57 |
* @param aSalt The salt
|
sl@0
|
58 |
* @param aIV The Initialization Vector
|
sl@0
|
59 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
60 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
IMPORT_C static CPBEncryptParms* NewL(TPBECipher aCipher,
|
sl@0
|
63 |
const TDesC8& aSalt, const TDesC8& aIV, TUint aIterations);
|
sl@0
|
64 |
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Creates a new CPBEncryptParms object and puts a pointer to it onto the cleanup stack.
|
sl@0
|
67 |
*
|
sl@0
|
68 |
* @param aCipher The cipher to use
|
sl@0
|
69 |
* @param aSalt The salt
|
sl@0
|
70 |
* @param aIV The Initialization Vector
|
sl@0
|
71 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
72 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
IMPORT_C static CPBEncryptParms* NewLC(TPBECipher aCipher,
|
sl@0
|
75 |
const TDesC8& aSalt, const TDesC8& aIV, TUint aIterations);
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
* Creates a new CPBEncryptParms object from an existing object.
|
sl@0
|
79 |
*
|
sl@0
|
80 |
* @param aParms The existing encryption parameters object
|
sl@0
|
81 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
IMPORT_C static CPBEncryptParms* NewL(const CPBEncryptParms& aParms);
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* Creates a new CPBEncryptParms object from an existing object
|
sl@0
|
87 |
* and puts a pointer to it onto the cleanup stack.
|
sl@0
|
88 |
*
|
sl@0
|
89 |
* @param aParms The existing encryption parameters object
|
sl@0
|
90 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
91 |
*/
|
sl@0
|
92 |
IMPORT_C static CPBEncryptParms* NewLC(const CPBEncryptParms& aParms);
|
sl@0
|
93 |
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
* Internalizes encryption parameter data from a read stream.
|
sl@0
|
96 |
*
|
sl@0
|
97 |
* @param aStream The read stream to be internalized
|
sl@0
|
98 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
99 |
*
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
IMPORT_C static CPBEncryptParms* NewL(RReadStream& aStream);
|
sl@0
|
102 |
|
sl@0
|
103 |
/**
|
sl@0
|
104 |
* Internalizes encryption parameter data from a read stream, and
|
sl@0
|
105 |
* puts a pointer to the new object onto the cleanup stack.
|
sl@0
|
106 |
*
|
sl@0
|
107 |
* @param aStream The read stream to be internalized
|
sl@0
|
108 |
* @return A pointer to the new CPBEncryptParms object
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
IMPORT_C static CPBEncryptParms* NewLC(RReadStream& aStream);
|
sl@0
|
111 |
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
* Gets the PBE cipher
|
sl@0
|
114 |
*
|
sl@0
|
115 |
* @return The cipher to use
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
IMPORT_C TPBECipher Cipher() const;
|
sl@0
|
118 |
/**
|
sl@0
|
119 |
Gets the key derivation function (KDF.)
|
sl@0
|
120 |
|
sl@0
|
121 |
@return The key derivation function (KDF) which
|
sl@0
|
122 |
transforms the password into an encryption key.
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
IMPORT_C TKdf Kdf() const;
|
sl@0
|
125 |
|
sl@0
|
126 |
/**
|
sl@0
|
127 |
* Gets the PBE salt
|
sl@0
|
128 |
*
|
sl@0
|
129 |
* @return The salt
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
IMPORT_C TPtrC8 Salt() const;
|
sl@0
|
132 |
|
sl@0
|
133 |
/**
|
sl@0
|
134 |
* Gets the number of iterations for the PKCS#5 algorithm.
|
sl@0
|
135 |
*
|
sl@0
|
136 |
* @return The number of iterations
|
sl@0
|
137 |
*/
|
sl@0
|
138 |
IMPORT_C TInt Iterations() const;
|
sl@0
|
139 |
|
sl@0
|
140 |
/**
|
sl@0
|
141 |
* Gets the PBE Initialization Vector
|
sl@0
|
142 |
*
|
sl@0
|
143 |
* @return The IV
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
IMPORT_C TPtrC8 IV() const;
|
sl@0
|
146 |
|
sl@0
|
147 |
IMPORT_C void SetIV(const TDesC8& aNewIv);
|
sl@0
|
148 |
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
* Externalizes the encryption parameters into a write stream.
|
sl@0
|
151 |
*
|
sl@0
|
152 |
* @param aStream The stream to write to
|
sl@0
|
153 |
*/
|
sl@0
|
154 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
155 |
IMPORT_C static CPBEncryptParms* NewL();
|
sl@0
|
156 |
IMPORT_C static CPBEncryptParms* NewLC();
|
sl@0
|
157 |
|
sl@0
|
158 |
IMPORT_C void SetCipher(TPBECipher aCipher);
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
* Replace the current cipher. This function resizes the
|
sl@0
|
162 |
* IV and replaces its existing contents.
|
sl@0
|
163 |
*
|
sl@0
|
164 |
* @param aCipher New cipher.
|
sl@0
|
165 |
* @leave System wide error code.
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
inline void SetCipherL(TPBECipher aCipher)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
SetCipher(aCipher);
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
IMPORT_C void SetKdf(TKdf aKdf);
|
sl@0
|
173 |
IMPORT_C void ResizeSaltL(TInt aNewLen);
|
sl@0
|
174 |
IMPORT_C void SetIterations(TInt aIterCount);
|
sl@0
|
175 |
|
sl@0
|
176 |
/** Destructor */
|
sl@0
|
177 |
virtual ~CPBEncryptParms(void);
|
sl@0
|
178 |
/** @internalAll */
|
sl@0
|
179 |
void DeriveKeyL(const TDesC8& aPassword, TDes8& aKeyBuf) const;
|
sl@0
|
180 |
|
sl@0
|
181 |
|
sl@0
|
182 |
protected:
|
sl@0
|
183 |
#ifdef PBEDATA_NO_EXPORTED_CONSTRUCTORS
|
sl@0
|
184 |
/** @internalAll */
|
sl@0
|
185 |
CPBEncryptParms(void);
|
sl@0
|
186 |
#else
|
sl@0
|
187 |
/** Constructor */
|
sl@0
|
188 |
IMPORT_C CPBEncryptParms(void);
|
sl@0
|
189 |
#endif
|
sl@0
|
190 |
|
sl@0
|
191 |
/** @internalAll */
|
sl@0
|
192 |
void ConstructL();
|
sl@0
|
193 |
|
sl@0
|
194 |
/** @internalAll*/
|
sl@0
|
195 |
void ConstructL(TPBECipher aCipher, const TDesC8& aSalt,
|
sl@0
|
196 |
const TDesC8& aIV, TUint aIterations);
|
sl@0
|
197 |
/** @internalAll*/
|
sl@0
|
198 |
void ConstructL(const CPBEncryptParms& aParms);
|
sl@0
|
199 |
/** @internalAll*/
|
sl@0
|
200 |
void ConstructL(RReadStream& aStream);
|
sl@0
|
201 |
private:
|
sl@0
|
202 |
CPBEncryptParms(const CPBEncryptParms&);
|
sl@0
|
203 |
CPBEncryptParms& operator= (const CPBEncryptParms&);
|
sl@0
|
204 |
private:
|
sl@0
|
205 |
class TParamsData
|
sl@0
|
206 |
/**
|
sl@0
|
207 |
This class contains multiple objects. Its
|
sl@0
|
208 |
pointer is stored in CPBEncryptParms to preserve
|
sl@0
|
209 |
BC, because CPBEncryptParms has an exported,
|
sl@0
|
210 |
protected constructor.
|
sl@0
|
211 |
*/
|
sl@0
|
212 |
{
|
sl@0
|
213 |
public:
|
sl@0
|
214 |
TPBECipher iCipher;
|
sl@0
|
215 |
/**
|
sl@0
|
216 |
The password is processed with this function
|
sl@0
|
217 |
to generate the encryption key.
|
sl@0
|
218 |
*/
|
sl@0
|
219 |
TKdf iKdf;
|
sl@0
|
220 |
};
|
sl@0
|
221 |
TParamsData* iData;
|
sl@0
|
222 |
|
sl@0
|
223 |
HBufC8* iSalt;
|
sl@0
|
224 |
HBufC8* iIV;
|
sl@0
|
225 |
TUint iIterations;
|
sl@0
|
226 |
};
|
sl@0
|
227 |
|
sl@0
|
228 |
/**
|
sl@0
|
229 |
* Contains the password based authentication data.
|
sl@0
|
230 |
* Used to check the passphrase when decrypting.
|
sl@0
|
231 |
*
|
sl@0
|
232 |
* @since v7.0s
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
class CPBAuthData : public CBase
|
sl@0
|
235 |
{
|
sl@0
|
236 |
public:
|
sl@0
|
237 |
/**
|
sl@0
|
238 |
* Derives an authentication key.
|
sl@0
|
239 |
*
|
sl@0
|
240 |
* @param aPassword The user's initial password
|
sl@0
|
241 |
* @param aSalt The salt
|
sl@0
|
242 |
* @param aKeySize The key size
|
sl@0
|
243 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
244 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
245 |
*/
|
sl@0
|
246 |
IMPORT_C static CPBAuthData* NewL(const TDesC8& aPassword,
|
sl@0
|
247 |
const TDesC8& aSalt, TUint aKeySize, TUint aIterations);
|
sl@0
|
248 |
|
sl@0
|
249 |
/**
|
sl@0
|
250 |
* Derives an authentication key.
|
sl@0
|
251 |
*
|
sl@0
|
252 |
* The returned pointer is put onto the cleanup stack.
|
sl@0
|
253 |
*
|
sl@0
|
254 |
* @param aPassword The user's initial password
|
sl@0
|
255 |
* @param aSalt The salt
|
sl@0
|
256 |
* @param aKeySize The key size
|
sl@0
|
257 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
258 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
IMPORT_C static CPBAuthData* NewLC(const TDesC8& aPassword,
|
sl@0
|
261 |
const TDesC8& aSalt, TUint aKeySize, TUint aIterations);
|
sl@0
|
262 |
|
sl@0
|
263 |
/**
|
sl@0
|
264 |
* Creates a new CPBAuthData object from an existing authentication key.
|
sl@0
|
265 |
*
|
sl@0
|
266 |
* @param aData The existing CPBAuthData object
|
sl@0
|
267 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
268 |
*/
|
sl@0
|
269 |
IMPORT_C static CPBAuthData* NewL(const CPBAuthData& aData);
|
sl@0
|
270 |
|
sl@0
|
271 |
/**
|
sl@0
|
272 |
* Creates a new CPBAuthData object from an existing authentication key.
|
sl@0
|
273 |
*
|
sl@0
|
274 |
* The returned pointer is put onto the cleanup stack.
|
sl@0
|
275 |
*
|
sl@0
|
276 |
* @param aData The existing CPBAuthData object
|
sl@0
|
277 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
278 |
*/
|
sl@0
|
279 |
IMPORT_C static CPBAuthData* NewLC(const CPBAuthData& aData);
|
sl@0
|
280 |
|
sl@0
|
281 |
/**
|
sl@0
|
282 |
* Creates a new CPBAuthData object from an existing authentication key
|
sl@0
|
283 |
* by internalizing the authentication data from a read stream.
|
sl@0
|
284 |
*
|
sl@0
|
285 |
* @param aStream The stream to read from
|
sl@0
|
286 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
287 |
*/
|
sl@0
|
288 |
IMPORT_C static CPBAuthData* NewL(RReadStream& aStream);
|
sl@0
|
289 |
|
sl@0
|
290 |
/**
|
sl@0
|
291 |
* Creates a new CPBAuthData object from an existing authentication key
|
sl@0
|
292 |
* by internalizing the authentication data from a read stream.
|
sl@0
|
293 |
*
|
sl@0
|
294 |
* The returned pointer is put onto the cleanup stack.
|
sl@0
|
295 |
*
|
sl@0
|
296 |
* @param aStream The stream to read from
|
sl@0
|
297 |
* @return A pointer to the new CPBAuthData object
|
sl@0
|
298 |
*/
|
sl@0
|
299 |
IMPORT_C static CPBAuthData* NewLC(RReadStream& aStream);
|
sl@0
|
300 |
|
sl@0
|
301 |
/**
|
sl@0
|
302 |
* Gets the authentication key
|
sl@0
|
303 |
*
|
sl@0
|
304 |
* @return The key
|
sl@0
|
305 |
*/
|
sl@0
|
306 |
IMPORT_C TPtrC8 Key() const;
|
sl@0
|
307 |
|
sl@0
|
308 |
/**
|
sl@0
|
309 |
* Gets the salt used for the authentication
|
sl@0
|
310 |
*
|
sl@0
|
311 |
* @return The salt
|
sl@0
|
312 |
*/
|
sl@0
|
313 |
IMPORT_C TPtrC8 Salt() const;
|
sl@0
|
314 |
|
sl@0
|
315 |
/**
|
sl@0
|
316 |
* Gets the number of iterations of the hashing algorithm.
|
sl@0
|
317 |
*
|
sl@0
|
318 |
* @return The number of iterations
|
sl@0
|
319 |
*/
|
sl@0
|
320 |
IMPORT_C TInt Iterations() const;
|
sl@0
|
321 |
|
sl@0
|
322 |
/**
|
sl@0
|
323 |
* Tests whether two authentication keys are identical
|
sl@0
|
324 |
*
|
sl@0
|
325 |
* @param aAuth The authentication data object which holds the key to be tested
|
sl@0
|
326 |
* @return ETrue, if they are identical; EFalse, otherwise
|
sl@0
|
327 |
*/
|
sl@0
|
328 |
IMPORT_C TBool operator==(const CPBAuthData& aAuth) const;
|
sl@0
|
329 |
|
sl@0
|
330 |
/**
|
sl@0
|
331 |
* Externalizes the encryption parameters into a write stream.
|
sl@0
|
332 |
*
|
sl@0
|
333 |
* @param aStream The stream to write to
|
sl@0
|
334 |
*/
|
sl@0
|
335 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
336 |
|
sl@0
|
337 |
/** Destructor */
|
sl@0
|
338 |
virtual ~CPBAuthData(void);
|
sl@0
|
339 |
protected:
|
sl@0
|
340 |
#ifdef PBEDATA_NO_EXPORTED_CONSTRUCTORS
|
sl@0
|
341 |
CPBAuthData(void);
|
sl@0
|
342 |
#else
|
sl@0
|
343 |
/** Constructor */
|
sl@0
|
344 |
IMPORT_C CPBAuthData(void);
|
sl@0
|
345 |
#endif
|
sl@0
|
346 |
/** @internalAll */
|
sl@0
|
347 |
void ConstructL(const TDesC8& aPassword, const TDesC8& aSalt,
|
sl@0
|
348 |
TUint aKeySize, TUint aIterations);
|
sl@0
|
349 |
/** @internalAll */
|
sl@0
|
350 |
void ConstructL(const CPBAuthData& aData);
|
sl@0
|
351 |
/** @internalAll */
|
sl@0
|
352 |
void ConstructL(RReadStream& aStream);
|
sl@0
|
353 |
private:
|
sl@0
|
354 |
CPBAuthData(const CPBAuthData&);
|
sl@0
|
355 |
CPBAuthData& operator= (const CPBAuthData&);
|
sl@0
|
356 |
private:
|
sl@0
|
357 |
HBufC8* iAuthKey;
|
sl@0
|
358 |
HBufC8* iSalt;
|
sl@0
|
359 |
TUint iIterations;
|
sl@0
|
360 |
};
|
sl@0
|
361 |
|
sl@0
|
362 |
/**
|
sl@0
|
363 |
* Represents the information needed to decrypt encrypted data given the correct password.
|
sl@0
|
364 |
* Contains the authentication key, and the parameters used to derive the encryption key.
|
sl@0
|
365 |
* A CPBEncryptionData object needs to be stored to recover any data for later use.
|
sl@0
|
366 |
*
|
sl@0
|
367 |
* @see CPBEncryptParms
|
sl@0
|
368 |
* @see CPBAuthData
|
sl@0
|
369 |
*
|
sl@0
|
370 |
* @since v7.0s
|
sl@0
|
371 |
*/
|
sl@0
|
372 |
class CPBEncryptionData : public CBase
|
sl@0
|
373 |
{
|
sl@0
|
374 |
public:
|
sl@0
|
375 |
/**
|
sl@0
|
376 |
* Creates a new CPBEncryptionData object
|
sl@0
|
377 |
*
|
sl@0
|
378 |
* @param aPassword The user's initial password
|
sl@0
|
379 |
* @param aCipher The cipher to use
|
sl@0
|
380 |
* @param aAuthSalt The salt used for the authentication
|
sl@0
|
381 |
* @param aEncryptSalt The salt used for the encryption
|
sl@0
|
382 |
* @param aIV The Initialization Vector
|
sl@0
|
383 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
384 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
385 |
*/
|
sl@0
|
386 |
IMPORT_C static CPBEncryptionData* NewL(const TDesC8& aPassword,
|
sl@0
|
387 |
TPBECipher aCipher, const TDesC8& aAuthSalt,
|
sl@0
|
388 |
const TDesC8& aEncryptSalt, const TDesC8& aIV, TUint aIterations);
|
sl@0
|
389 |
|
sl@0
|
390 |
/**
|
sl@0
|
391 |
* Creates a new CPBEncryptionData object
|
sl@0
|
392 |
* and puts a pointer to it onto the cleanup stack.
|
sl@0
|
393 |
*
|
sl@0
|
394 |
* @param aPassword The user's initial password
|
sl@0
|
395 |
* @param aCipher The cipher to use
|
sl@0
|
396 |
* @param aAuthSalt The salt used for the authentication
|
sl@0
|
397 |
* @param aEncryptSalt The salt used for the encryption
|
sl@0
|
398 |
* @param aIV The Initialization Vector
|
sl@0
|
399 |
* @param aIterations The number of iterations of the PBE algorithm
|
sl@0
|
400 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
401 |
*/
|
sl@0
|
402 |
IMPORT_C static CPBEncryptionData* NewLC(const TDesC8& aPassword,
|
sl@0
|
403 |
TPBECipher aCipher, const TDesC8& aAuthSalt,
|
sl@0
|
404 |
const TDesC8& aEncryptSalt, const TDesC8& aIV, TUint aIterations);
|
sl@0
|
405 |
|
sl@0
|
406 |
/**
|
sl@0
|
407 |
* Creates a new CPBEncryptionData from an existing one.
|
sl@0
|
408 |
*
|
sl@0
|
409 |
* @param aData The existing CPBEncryptionData object
|
sl@0
|
410 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
411 |
*/
|
sl@0
|
412 |
IMPORT_C static CPBEncryptionData* NewL(const CPBEncryptionData& aData);
|
sl@0
|
413 |
|
sl@0
|
414 |
/**
|
sl@0
|
415 |
* Creates a new CPBEncryptionData from an existing one,
|
sl@0
|
416 |
* and puts a pointer to it onto the cleanup stack.
|
sl@0
|
417 |
*
|
sl@0
|
418 |
* @param aData The existing CPBEncryptionData object
|
sl@0
|
419 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
420 |
*/
|
sl@0
|
421 |
IMPORT_C static CPBEncryptionData* NewLC(const CPBEncryptionData& aData);
|
sl@0
|
422 |
|
sl@0
|
423 |
/**
|
sl@0
|
424 |
* Internalizes the encryption data from a read stream.
|
sl@0
|
425 |
*
|
sl@0
|
426 |
* @param aStream The stream to read from
|
sl@0
|
427 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
428 |
*/
|
sl@0
|
429 |
IMPORT_C static CPBEncryptionData* NewL(RReadStream& aStream);
|
sl@0
|
430 |
|
sl@0
|
431 |
/**
|
sl@0
|
432 |
* Internalizes the encryption data from a read stream,
|
sl@0
|
433 |
* and puts a pointer to it onto the cleanup stack.
|
sl@0
|
434 |
*
|
sl@0
|
435 |
* @param aStream The stream to read from
|
sl@0
|
436 |
* @return A pointer to the new CPBEncryptionData object
|
sl@0
|
437 |
*/
|
sl@0
|
438 |
IMPORT_C static CPBEncryptionData* NewLC(RReadStream& aStream);
|
sl@0
|
439 |
IMPORT_C static CPBEncryptionData* NewL(
|
sl@0
|
440 |
const TDesC8& aPassword, const TDesC8& aAuthSalt,
|
sl@0
|
441 |
const CPBEncryptParms& aParms);
|
sl@0
|
442 |
|
sl@0
|
443 |
|
sl@0
|
444 |
/**
|
sl@0
|
445 |
* Returns the encryption parameter object.
|
sl@0
|
446 |
*
|
sl@0
|
447 |
* @return The CPBEncryptParms object
|
sl@0
|
448 |
*/
|
sl@0
|
449 |
IMPORT_C const CPBEncryptParms& EncryptParms() const;
|
sl@0
|
450 |
|
sl@0
|
451 |
/**
|
sl@0
|
452 |
* Returns the authentication data object.
|
sl@0
|
453 |
*
|
sl@0
|
454 |
* @return The CPBAuthData object
|
sl@0
|
455 |
*/
|
sl@0
|
456 |
IMPORT_C const CPBAuthData& AuthData() const;
|
sl@0
|
457 |
|
sl@0
|
458 |
/**
|
sl@0
|
459 |
* Externalizes the encryption data into a write stream.
|
sl@0
|
460 |
*
|
sl@0
|
461 |
* @param aStream The stream to write to
|
sl@0
|
462 |
*/
|
sl@0
|
463 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
464 |
|
sl@0
|
465 |
/** Destructor */
|
sl@0
|
466 |
virtual ~CPBEncryptionData(void);
|
sl@0
|
467 |
protected:
|
sl@0
|
468 |
#ifdef PBEDATA_NO_EXPORTED_CONSTRUCTORS
|
sl@0
|
469 |
CPBEncryptionData(void);
|
sl@0
|
470 |
#else
|
sl@0
|
471 |
/** Constructor */
|
sl@0
|
472 |
IMPORT_C CPBEncryptionData(void);
|
sl@0
|
473 |
#endif
|
sl@0
|
474 |
/** @internalAll */
|
sl@0
|
475 |
void ConstructL(const TDesC8& aPassword, TPBECipher aCipher,
|
sl@0
|
476 |
const TDesC8& aAuthSalt, const TDesC8& aEncryptSalt, const TDesC8& aIV,
|
sl@0
|
477 |
TUint aIterations);
|
sl@0
|
478 |
/** @internalAll */
|
sl@0
|
479 |
void ConstructL(const CPBEncryptionData& aData);
|
sl@0
|
480 |
/** @internalAll */
|
sl@0
|
481 |
void ConstructL(
|
sl@0
|
482 |
const TDesC8& aPassword, const TDesC8& aAuthSalt,
|
sl@0
|
483 |
const CPBEncryptParms& aParms);
|
sl@0
|
484 |
/** @internalAll */
|
sl@0
|
485 |
void ConstructL(RReadStream& aStream);
|
sl@0
|
486 |
private:
|
sl@0
|
487 |
CPBEncryptionData(const CPBEncryptionData&);
|
sl@0
|
488 |
CPBEncryptionData& operator= (const CPBEncryptionData&);
|
sl@0
|
489 |
private:
|
sl@0
|
490 |
CPBEncryptParms* iParms;
|
sl@0
|
491 |
CPBAuthData* iAuth;
|
sl@0
|
492 |
};
|
sl@0
|
493 |
|
sl@0
|
494 |
#endif
|