sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-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 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@publishedPartner
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef __PKCS12_BAGS_H__
|
sl@0
|
26 |
#define __PKCS12_BAGS_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <asn1dec.h>
|
sl@0
|
29 |
#include <signed.h>
|
sl@0
|
30 |
#include <asnpkcs.h>
|
sl@0
|
31 |
#include <pkcs12kdf.h>
|
sl@0
|
32 |
#include <pkcs12safebag.h>
|
sl@0
|
33 |
#include <pkcs12attribute.h>
|
sl@0
|
34 |
#include <pkcs7contentinfo_v2.h>
|
sl@0
|
35 |
#include <pkcs7encrypteddataobject.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
namespace PKCS12
|
sl@0
|
38 |
{
|
sl@0
|
39 |
/** Object identifier for KeyBag */
|
sl@0
|
40 |
_LIT(KPkcs12KeyBagOID, "1.2.840.113549.1.12.10.1.1");
|
sl@0
|
41 |
|
sl@0
|
42 |
/** Object identifier for ShroudedKeyBag */
|
sl@0
|
43 |
_LIT(KPkcs12ShroudedKeyBagOID, "1.2.840.113549.1.12.10.1.2");
|
sl@0
|
44 |
|
sl@0
|
45 |
/** Object identifier for CertBag */
|
sl@0
|
46 |
_LIT(KPkcs12CertBagOID, "1.2.840.113549.1.12.10.1.3");
|
sl@0
|
47 |
|
sl@0
|
48 |
/** Object identifier for CrlBag */
|
sl@0
|
49 |
_LIT(KPkcs12CrlBagOID, "1.2.840.113549.1.12.10.1.4");
|
sl@0
|
50 |
|
sl@0
|
51 |
/** Object identifier for SecretBag */
|
sl@0
|
52 |
_LIT(KPkcs12SecretBagOID, "1.2.840.113549.1.12.10.1.5");
|
sl@0
|
53 |
|
sl@0
|
54 |
/** Object identifier for SafeContentsBag */
|
sl@0
|
55 |
_LIT(KPkcs12SafeContentsBagOID, "1.2.840.113549.1.12.10.1.6");
|
sl@0
|
56 |
|
sl@0
|
57 |
/** Object identifier for x509 certificate */
|
sl@0
|
58 |
_LIT(KX509CertificateOID,"1.2.840.113549.1.9.22.1");
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
This class decodes the KeyBag present in the SafeBag.
|
sl@0
|
62 |
It has a method to get the PrivatKeyInfo
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
class CDecPkcs12KeyBag : public CDecPkcs12SafeBag
|
sl@0
|
65 |
{
|
sl@0
|
66 |
public:
|
sl@0
|
67 |
/**
|
sl@0
|
68 |
Creates a new PKCS#12KeyBag object.
|
sl@0
|
69 |
|
sl@0
|
70 |
@param aSafeBagData Contains a PKCS#12 SafeBag Structure.
|
sl@0
|
71 |
@return A pointer to the newly allocated object.
|
sl@0
|
72 |
@leave KErrAgrument if the data is not a sequence or class tag name
|
sl@0
|
73 |
is not Universal and if iPrivateKeyInfo is NULL.
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
IMPORT_C static CDecPkcs12KeyBag* NewL(const TDesC8& aSafeBagData);
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
The PrivateKey information present in the KeyBag.
|
sl@0
|
79 |
The returned ASN1 sequence respects the following grammar:
|
sl@0
|
80 |
|
sl@0
|
81 |
PrivateKeyInfo ::= SEQUENCE {
|
sl@0
|
82 |
version Version,
|
sl@0
|
83 |
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
|
sl@0
|
84 |
privateKey PrivateKey,
|
sl@0
|
85 |
attributes [0] IMPLICIT Attributes OPTIONAL }
|
sl@0
|
86 |
|
sl@0
|
87 |
Version ::= INTEGER
|
sl@0
|
88 |
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
|
sl@0
|
89 |
PrivateKey ::= OCTET STRING
|
sl@0
|
90 |
Attributes ::= SET OF Attribute
|
sl@0
|
91 |
|
sl@0
|
92 |
@return A pointer to a CDecPKCS8Data object. Ownership of memory is transferred
|
sl@0
|
93 |
to the caller.
|
sl@0
|
94 |
@see CDecPKCS8Data
|
sl@0
|
95 |
*/
|
sl@0
|
96 |
IMPORT_C CDecPKCS8Data* PrivateKeyInfoL() const;
|
sl@0
|
97 |
|
sl@0
|
98 |
/**
|
sl@0
|
99 |
Destructor.
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
virtual ~CDecPkcs12KeyBag();
|
sl@0
|
102 |
|
sl@0
|
103 |
private:
|
sl@0
|
104 |
/**
|
sl@0
|
105 |
Decodes the entire KeyBag structure.
|
sl@0
|
106 |
@param aSafeBagData Contains a PKCS#12 SafeBag Structure.
|
sl@0
|
107 |
@leave KErrAgrument if the data is not a sequence or class tag name
|
sl@0
|
108 |
is not Universal and if iPrivateKeyInfo is NULL.
|
sl@0
|
109 |
@see TASN1DecPKCS8
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
void ConstructL(const TDesC8& aSafeBagData);
|
sl@0
|
112 |
|
sl@0
|
113 |
/**
|
sl@0
|
114 |
Constructor.
|
sl@0
|
115 |
*/
|
sl@0
|
116 |
CDecPkcs12KeyBag();
|
sl@0
|
117 |
|
sl@0
|
118 |
/**
|
sl@0
|
119 |
Copy Constructor.
|
sl@0
|
120 |
@param aDecPkcs12keyBag A CDecPkcs12KeyBag object.
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
CDecPkcs12KeyBag(const CDecPkcs12KeyBag& aDecPkcs12keyBag);
|
sl@0
|
123 |
|
sl@0
|
124 |
/**
|
sl@0
|
125 |
Assignment operator.
|
sl@0
|
126 |
@param aDecPkcs12keyBag A CDecPkcs12KeyBag object.
|
sl@0
|
127 |
@return A CDecPkcs12KeyBag class.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
CDecPkcs12KeyBag& operator=(const CDecPkcs12KeyBag& aDecPkcs12keyBag);
|
sl@0
|
130 |
};
|
sl@0
|
131 |
|
sl@0
|
132 |
|
sl@0
|
133 |
/**
|
sl@0
|
134 |
This class decodes the ShroudedKeyBag present in the SafeBag.
|
sl@0
|
135 |
It has a method to get the PrivatKeyInfo
|
sl@0
|
136 |
*/
|
sl@0
|
137 |
class CDecPkcs12ShroudedKeyBag : public CDecPkcs12SafeBag
|
sl@0
|
138 |
{
|
sl@0
|
139 |
public:
|
sl@0
|
140 |
/**
|
sl@0
|
141 |
Creates a new PKCS#12KeyBag object.
|
sl@0
|
142 |
|
sl@0
|
143 |
@param aSafeBagData Contains a PKCS#12 shroudedKeyBag structure.
|
sl@0
|
144 |
@return A pointer to the newly allocated object.
|
sl@0
|
145 |
@leave KErrAgrument if the data is not safeBag structure.
|
sl@0
|
146 |
*/
|
sl@0
|
147 |
IMPORT_C static CDecPkcs12ShroudedKeyBag* NewL(const TDesC8& aSafeBagData);
|
sl@0
|
148 |
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
The PrivateKey Information present in the ShroudKeyBag.
|
sl@0
|
151 |
Below is the ASN.1 sequence.
|
sl@0
|
152 |
|
sl@0
|
153 |
ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
|
sl@0
|
154 |
|
sl@0
|
155 |
AlgorithmIdentifier: A type that identifies an algorithm (by object identifier) and associated parameters
|
sl@0
|
156 |
AlgorithmIdentifier ::= SEQUENCE
|
sl@0
|
157 |
{
|
sl@0
|
158 |
algorithm ALGORITHM.&id({SupportedAlgorithms}),
|
sl@0
|
159 |
parameters ALGORITHM.&Type({SupportedAlgorithms}{@ algorithm}) OPTIONAL
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
@return A pointer to a CDecPKCS8Data object. Ownership is transferred to the caller.
|
sl@0
|
163 |
@leave KErrAgrument if the data is not a sequence or class tag name
|
sl@0
|
164 |
is not Universal.
|
sl@0
|
165 |
@leave KErrNotSupported if otherthan PKCS12 pbeIds.
|
sl@0
|
166 |
@leave KErrGeneral if the decryption of the final part length is less than 0.
|
sl@0
|
167 |
@see TASN1DecPKCS5, CPBEncryptElement, PKCS12KDF, CPBDecryptor, CDecPKCS8Data.
|
sl@0
|
168 |
*/
|
sl@0
|
169 |
IMPORT_C CDecPKCS8Data* PrivateKeyInfoL(TDesC& aPassword) const;
|
sl@0
|
170 |
|
sl@0
|
171 |
/**
|
sl@0
|
172 |
Destructor.
|
sl@0
|
173 |
*/
|
sl@0
|
174 |
virtual ~CDecPkcs12ShroudedKeyBag();
|
sl@0
|
175 |
|
sl@0
|
176 |
private:
|
sl@0
|
177 |
/**
|
sl@0
|
178 |
This decodes the entire KeyBag structure.
|
sl@0
|
179 |
@param aSafeBagData Contains a PKCS#12 shroudedKeyBag Structure.
|
sl@0
|
180 |
@leave KErrAgrument if the data is not a sequence or class tag name
|
sl@0
|
181 |
is not Universal.
|
sl@0
|
182 |
@see TASN1DecPKCS8
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
void ConstructL(const TDesC8& aSafeBagData);
|
sl@0
|
185 |
|
sl@0
|
186 |
/**
|
sl@0
|
187 |
Constructor.
|
sl@0
|
188 |
*/
|
sl@0
|
189 |
CDecPkcs12ShroudedKeyBag();
|
sl@0
|
190 |
|
sl@0
|
191 |
/**
|
sl@0
|
192 |
Copy Constructor.
|
sl@0
|
193 |
@param aDecPkcs12ShroudedKeyBag A CDecPkcs12ShroudedKeyBag object.
|
sl@0
|
194 |
@return A CDecPkcs12ShroudedKeyBag class.
|
sl@0
|
195 |
*/
|
sl@0
|
196 |
CDecPkcs12ShroudedKeyBag(const CDecPkcs12ShroudedKeyBag& aDecPkcs12ShroudedKeyBag);
|
sl@0
|
197 |
|
sl@0
|
198 |
/**
|
sl@0
|
199 |
Assignment operator.
|
sl@0
|
200 |
@param aDecPkcs12ShroudedKeyBag A CDecPkcs12ShroudedKeyBag object.
|
sl@0
|
201 |
*/
|
sl@0
|
202 |
CDecPkcs12ShroudedKeyBag& operator=(const CDecPkcs12ShroudedKeyBag& aDecPkcs12ShroudedKeyBag);
|
sl@0
|
203 |
};
|
sl@0
|
204 |
|
sl@0
|
205 |
|
sl@0
|
206 |
/**
|
sl@0
|
207 |
This class decodes the CertBag
|
sl@0
|
208 |
It has methods to get the CertId and the CertValue present in the CertBag
|
sl@0
|
209 |
The X509Certificate() method returns the x509 certificate
|
sl@0
|
210 |
in case the CertId is x509
|
sl@0
|
211 |
*/
|
sl@0
|
212 |
class CDecPkcs12CertBag : public CDecPkcs12SafeBag
|
sl@0
|
213 |
{
|
sl@0
|
214 |
public:
|
sl@0
|
215 |
/**
|
sl@0
|
216 |
Creates a new PKCS#12CertBag object.
|
sl@0
|
217 |
|
sl@0
|
218 |
@param aCertBagData contains a PKCS#12 CertBag Structure.
|
sl@0
|
219 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
220 |
is not Universal.
|
sl@0
|
221 |
@leave KErrNotSupported if otherthan X509 certificate is present.
|
sl@0
|
222 |
@return A pointer to the newly allocated object.
|
sl@0
|
223 |
*/
|
sl@0
|
224 |
IMPORT_C static CDecPkcs12CertBag* NewL(const TDesC8& aCertBagData);
|
sl@0
|
225 |
|
sl@0
|
226 |
/**
|
sl@0
|
227 |
This method returns the OID present in the certId field of CertBag sequence.
|
sl@0
|
228 |
@return Returns OID present in the certId feild of CertBag sequence
|
sl@0
|
229 |
*/
|
sl@0
|
230 |
IMPORT_C const TDesC& CertId() const;
|
sl@0
|
231 |
|
sl@0
|
232 |
/**
|
sl@0
|
233 |
This method returns the DER encoded certValue present in the CertBag sequence.
|
sl@0
|
234 |
@return The DER encoded certValue present in the CertBag sequence.
|
sl@0
|
235 |
@see X509Certificate
|
sl@0
|
236 |
*/
|
sl@0
|
237 |
IMPORT_C const TDesC8& CertValue() const;
|
sl@0
|
238 |
|
sl@0
|
239 |
/**
|
sl@0
|
240 |
This method returns the decoded x509 certificate.
|
sl@0
|
241 |
@return Returns a pointer to a CX509Certificate object if the certificate of type
|
sl@0
|
242 |
X509; otherwise, null is returned. Ownership of memory is transferred to the caller.
|
sl@0
|
243 |
@see CertValue
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
IMPORT_C CX509Certificate* X509CertificateL() const;
|
sl@0
|
246 |
|
sl@0
|
247 |
/**
|
sl@0
|
248 |
Destructor.
|
sl@0
|
249 |
*/
|
sl@0
|
250 |
virtual ~CDecPkcs12CertBag();
|
sl@0
|
251 |
private:
|
sl@0
|
252 |
/**
|
sl@0
|
253 |
This decodes the entire CertBag structure.
|
sl@0
|
254 |
@param aCertBagData contains a PKCS#12 CertBag Structure.
|
sl@0
|
255 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
256 |
is not Universal.
|
sl@0
|
257 |
@see CDecPkcs12SafeBag, CX509Certificate.
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
void ConstructL(const TDesC8& aCertBagData);
|
sl@0
|
260 |
|
sl@0
|
261 |
/**
|
sl@0
|
262 |
Constructor.
|
sl@0
|
263 |
*/
|
sl@0
|
264 |
CDecPkcs12CertBag();
|
sl@0
|
265 |
|
sl@0
|
266 |
/**
|
sl@0
|
267 |
Copy Constructor.
|
sl@0
|
268 |
@param aDecPkcs12CertBag A CDecPkcs12CertBag object.
|
sl@0
|
269 |
*/
|
sl@0
|
270 |
CDecPkcs12CertBag(const CDecPkcs12CertBag& aDecPkcs12CertBag);
|
sl@0
|
271 |
|
sl@0
|
272 |
/**
|
sl@0
|
273 |
Assignment operator.
|
sl@0
|
274 |
@param aDecPkcs12CertBag A CDecPkcs12CertBag object.
|
sl@0
|
275 |
@return A CDecPkcs12CertBag class.
|
sl@0
|
276 |
*/
|
sl@0
|
277 |
CDecPkcs12CertBag& operator=(const CDecPkcs12CertBag& aDecPkcs12CertBag);
|
sl@0
|
278 |
|
sl@0
|
279 |
private:
|
sl@0
|
280 |
/** Contains Object identifier indicating the certificate type*/
|
sl@0
|
281 |
HBufC* iCertId;
|
sl@0
|
282 |
|
sl@0
|
283 |
/** Contains the certificate which is encoded and is an OCTET String */
|
sl@0
|
284 |
TPtrC8 iCertValue;
|
sl@0
|
285 |
};
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
Decodes the SafeContents bag present within a SafeBag and
|
sl@0
|
289 |
returns an array of Safebags present within this SafeContents bag.
|
sl@0
|
290 |
*/
|
sl@0
|
291 |
class CDecPkcs12SafeContentsBag : public CDecPkcs12SafeBag
|
sl@0
|
292 |
{
|
sl@0
|
293 |
public:
|
sl@0
|
294 |
/**
|
sl@0
|
295 |
Creates a new PKCS#12SafeContentsBag object.
|
sl@0
|
296 |
|
sl@0
|
297 |
@param aSafeContentsBagData Contains a PKCS#12 SafeBag structure.
|
sl@0
|
298 |
@return A pointer to the newly allocated object.
|
sl@0
|
299 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
300 |
is not Universal.
|
sl@0
|
301 |
*/
|
sl@0
|
302 |
IMPORT_C static CDecPkcs12SafeContentsBag* NewL(const TDesC8& aSafeContentsBagData);
|
sl@0
|
303 |
/**
|
sl@0
|
304 |
The SafeContents Bag contains one or more Safe Bags in it.This
|
sl@0
|
305 |
method returns the reference to all these SafeBags.
|
sl@0
|
306 |
|
sl@0
|
307 |
@return An array of SafeBags present within the SafeContentsBag
|
sl@0
|
308 |
*/
|
sl@0
|
309 |
IMPORT_C const RPointerArray<CDecPkcs12SafeBag>& SafeBags() const;
|
sl@0
|
310 |
|
sl@0
|
311 |
/**
|
sl@0
|
312 |
Destructor.
|
sl@0
|
313 |
*/
|
sl@0
|
314 |
virtual ~CDecPkcs12SafeContentsBag();
|
sl@0
|
315 |
|
sl@0
|
316 |
private:
|
sl@0
|
317 |
/**
|
sl@0
|
318 |
This decodes the entire SafeContentsBag structure.
|
sl@0
|
319 |
@param aSafeContentsBagData Contains a PKCS#12 SafeBag structure.
|
sl@0
|
320 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
321 |
is not Universal.
|
sl@0
|
322 |
@see CDecPkcs12SafeBag
|
sl@0
|
323 |
*/
|
sl@0
|
324 |
void ConstructL(const TDesC8& aSafeContentsBagData);
|
sl@0
|
325 |
|
sl@0
|
326 |
/**
|
sl@0
|
327 |
Constructor.
|
sl@0
|
328 |
*/
|
sl@0
|
329 |
CDecPkcs12SafeContentsBag();
|
sl@0
|
330 |
|
sl@0
|
331 |
/**
|
sl@0
|
332 |
Copy Constructor.
|
sl@0
|
333 |
@param aDecPkcs12SafeContentsBag A CDecPkcs12SafeContentsBag object.
|
sl@0
|
334 |
*/
|
sl@0
|
335 |
CDecPkcs12SafeContentsBag(const CDecPkcs12SafeContentsBag& aDecPkcs12SafeContentsBag);
|
sl@0
|
336 |
|
sl@0
|
337 |
/**
|
sl@0
|
338 |
Assignment operator.
|
sl@0
|
339 |
@param aDecPkcs12SafeContentsBag A CDecPkcs12SafeContentsBag object.
|
sl@0
|
340 |
@return A reference to CDecPkcs12SafeContentsBag class.
|
sl@0
|
341 |
*/
|
sl@0
|
342 |
CDecPkcs12SafeContentsBag& operator=(const CDecPkcs12SafeContentsBag& aDecPkcs12SafeContentsBag);
|
sl@0
|
343 |
|
sl@0
|
344 |
private:
|
sl@0
|
345 |
/** Contains an array of SafeBags present within the SafeContents Bag */
|
sl@0
|
346 |
RPointerArray<CDecPkcs12SafeBag> iSafeBags;
|
sl@0
|
347 |
};
|
sl@0
|
348 |
|
sl@0
|
349 |
class CDecPkcs12SafeContents : public CBase
|
sl@0
|
350 |
{
|
sl@0
|
351 |
public:
|
sl@0
|
352 |
/**
|
sl@0
|
353 |
Creates a new CDecPkcs12SafeContents object for plain Data.
|
sl@0
|
354 |
|
sl@0
|
355 |
@param aSafeContentsBagData Contains a PKCS#7 ContentInfo Structure.
|
sl@0
|
356 |
@return A pointer to the newly allocated object.
|
sl@0
|
357 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
358 |
is not Universal.
|
sl@0
|
359 |
*/
|
sl@0
|
360 |
IMPORT_C static CDecPkcs12SafeContents* NewL(const CPKCS7ContentInfo& aSafeContentsBagData);
|
sl@0
|
361 |
|
sl@0
|
362 |
/**
|
sl@0
|
363 |
Creates a new CDecPkcs12SafeContents object for Encrypted Data.
|
sl@0
|
364 |
|
sl@0
|
365 |
@param aSafeContentsBagData Contains a PKCS#7 ContentInfo Structure.
|
sl@0
|
366 |
@param aPassword aPassword is the password used for decryption.
|
sl@0
|
367 |
@return A pointer to the newly allocated object.
|
sl@0
|
368 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
369 |
is not Universal.
|
sl@0
|
370 |
*/
|
sl@0
|
371 |
IMPORT_C static CDecPkcs12SafeContents* NewL(const CPKCS7ContentInfo& aSafeContentsBagData, const TDesC& aPassword);
|
sl@0
|
372 |
|
sl@0
|
373 |
/**
|
sl@0
|
374 |
Creates a new CDecPkcs12SafeContents object for Enveloped Data.
|
sl@0
|
375 |
The class doesn't support the public key privacy mode if the
|
sl@0
|
376 |
ContentInfo contains an EnvelopedData object.Client should decrypt
|
sl@0
|
377 |
the Envelope Data. A recipient opens the envelope by decrypting the
|
sl@0
|
378 |
one of the encrypted content-encryption keys with the recipient's
|
sl@0
|
379 |
private key and decrypts the encrypted content with the recovered
|
sl@0
|
380 |
content-encryption key and pass the plain data.
|
sl@0
|
381 |
@param aSafeContentsBagData Contains a PKCS#7 ContentInfo Structure ContentData.
|
sl@0
|
382 |
@return A pointer to the newly allocated object.
|
sl@0
|
383 |
@leave KErrArgument if the data is not a sequence or class tag name
|
sl@0
|
384 |
is not Universal.
|
sl@0
|
385 |
*/
|
sl@0
|
386 |
IMPORT_C static CDecPkcs12SafeContents* NewL(const TDesC8& aSafeContentsBagData);
|
sl@0
|
387 |
|
sl@0
|
388 |
/**
|
sl@0
|
389 |
The method returns the plain data.
|
sl@0
|
390 |
@return A pointer to descriptor containing decrypted data.
|
sl@0
|
391 |
Returns NULL pointer if the decrypted data is not present.
|
sl@0
|
392 |
*/
|
sl@0
|
393 |
IMPORT_C const TDesC8* DecryptedData() const;
|
sl@0
|
394 |
|
sl@0
|
395 |
/**
|
sl@0
|
396 |
The method returns array of safebags objects.
|
sl@0
|
397 |
@return A pointer to array of safeBag objects.
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
IMPORT_C const RPointerArray<CDecPkcs12SafeBag>& SafeContentsBags() const;
|
sl@0
|
400 |
|
sl@0
|
401 |
/**
|
sl@0
|
402 |
Destructor.
|
sl@0
|
403 |
*/
|
sl@0
|
404 |
virtual ~CDecPkcs12SafeContents();
|
sl@0
|
405 |
|
sl@0
|
406 |
private:
|
sl@0
|
407 |
/**
|
sl@0
|
408 |
These objects represents the SafeBag Sequences present in the
|
sl@0
|
409 |
SafeContents Bag Sequence.
|
sl@0
|
410 |
|
sl@0
|
411 |
@param aSafeContent Contains data to decode the bags.
|
sl@0
|
412 |
@leave KErrArgument if the aSafeContent is not a Sequence and class tag is not Universal.
|
sl@0
|
413 |
@leave KErrNotSupported if any bag otherthan keyBag, shroudedKeyBag,CertBag,CRLBag,SecretBag
|
sl@0
|
414 |
and SafeContentBag.
|
sl@0
|
415 |
@see CDecPkcs12SafeBag
|
sl@0
|
416 |
*/
|
sl@0
|
417 |
void ConstructL(const TDesC8& aSafeContent);
|
sl@0
|
418 |
|
sl@0
|
419 |
/**
|
sl@0
|
420 |
This method decrypts the encrypted information.
|
sl@0
|
421 |
@param aContentInfo Contains a PKCS#7 ContentInfo Structure.
|
sl@0
|
422 |
@param aPassword is the password used for decryption.
|
sl@0
|
423 |
*/
|
sl@0
|
424 |
void DecodeEncryptedDataL(const CPKCS7ContentInfo& aContentInfo, const TDesC& aPassword);
|
sl@0
|
425 |
|
sl@0
|
426 |
/**
|
sl@0
|
427 |
Constructor.
|
sl@0
|
428 |
*/
|
sl@0
|
429 |
CDecPkcs12SafeContents();
|
sl@0
|
430 |
|
sl@0
|
431 |
/**
|
sl@0
|
432 |
Copy Constructor.
|
sl@0
|
433 |
@param aDecPkcs12SafeContents A CDecPkcs12SafeContents object.
|
sl@0
|
434 |
*/
|
sl@0
|
435 |
CDecPkcs12SafeContents(const CDecPkcs12SafeContents& aDecPkcs12SafeContents);
|
sl@0
|
436 |
|
sl@0
|
437 |
/**
|
sl@0
|
438 |
Assignment operator.
|
sl@0
|
439 |
@param aDecPkcs12SafeContents A CDecPkcs12SafeContents object.
|
sl@0
|
440 |
@return A reference to CDecPkcs12SafeContents class.
|
sl@0
|
441 |
*/
|
sl@0
|
442 |
CDecPkcs12SafeContents& operator=(const CDecPkcs12SafeContents& aDecPkcs12SafeContents);
|
sl@0
|
443 |
|
sl@0
|
444 |
|
sl@0
|
445 |
private:
|
sl@0
|
446 |
/** Contains an array of SafeBags objects */
|
sl@0
|
447 |
RPointerArray<CDecPkcs12SafeBag> iSafeBags;
|
sl@0
|
448 |
|
sl@0
|
449 |
/** Contains plain data */
|
sl@0
|
450 |
HBufC8* iDecryptedData;
|
sl@0
|
451 |
|
sl@0
|
452 |
};
|
sl@0
|
453 |
} // namespace PKCS12
|
sl@0
|
454 |
#endif // __PKCS12BAGS_H__
|