|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * This file contains the declaration of classe CPkcs12Parser to parse the PKCS12 data |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 */ |
|
26 #ifndef __TPKCS12COMMON_H |
|
27 #define __TPKCS12COMMON_H |
|
28 |
|
29 #include <pkcs12.h> |
|
30 |
|
31 using namespace PKCS12; |
|
32 //System Include |
|
33 #include <e32base.h> |
|
34 #include <pkcs12bags.h> |
|
35 #include <pkcs12attribute.h> |
|
36 #include <pkcs12macdata.h> |
|
37 #include <asn1enc.h> |
|
38 #include <asymmetrickeys.h> |
|
39 |
|
40 //user include |
|
41 #include "tpkcs12data.h" |
|
42 |
|
43 /** |
|
44 Contains methods to parse the PFX structure. |
|
45 */ |
|
46 class CPkcs12Parser : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 static CPkcs12Parser* NewL(); |
|
51 |
|
52 static CPkcs12Parser* NewLC(); |
|
53 |
|
54 void SetIntegrityPasswordL(const TDesC& aIntegrityPassword); |
|
55 |
|
56 void SetPrivacyPassword(RPointerArray<TDesC>& aPrivacyPassword); |
|
57 |
|
58 void SetDataL(const TDesC& aDatapath); |
|
59 |
|
60 void ParseL(); |
|
61 /** to get the reference to PfxHeader object*/ |
|
62 inline CPfxHeader& PfxHeader() {return *iPkcs12Header;} |
|
63 /** to get the reference to array contains the pointers to CSafeContentBag objects*/ |
|
64 inline RPointerArray<CSafeContentBag>& ArraySafeContentBag() {return iArraySafecontentBag;} |
|
65 /** to get the reference to array contains the pointers to CSafeBagData objects*/ |
|
66 inline RPointerArray<CSafeBagData>& ArraySafeBagData() {return iArrayBagData;} |
|
67 |
|
68 ~CPkcs12Parser(); |
|
69 private: |
|
70 |
|
71 CPkcs12Parser(); |
|
72 |
|
73 CSafeBagData* CreateBagDataL(TInt aContentInfo, TInt aContentType ); |
|
74 |
|
75 void ParseSafeBagL(TInt aContentInfo , TInt aContentType ,CDecPkcs12SafeBag& aSafeBag); |
|
76 |
|
77 void BagAttributesL(const CDecPkcs12SafeBag& aSafeBag ,CSafeBagData& abagData) ; |
|
78 |
|
79 void ParseKeyBag(CDecPkcs12KeyBag& aKeyBag , CSafeBagData& abagData); |
|
80 |
|
81 void ParseShroudedKeyBagL(CDecPkcs12ShroudedKeyBag& aKeyBag , CSafeBagData& abagData , TInt aPassIndex); |
|
82 |
|
83 void ParseCertBag(CDecPkcs12CertBag& aCertBag , CSafeBagData& abagData); |
|
84 |
|
85 void ParseSafeContentBagL(CDecPkcs12SafeContentsBag& safeContentsBag, TInt aContentinfo , TInt aContentType ) ; |
|
86 |
|
87 |
|
88 |
|
89 private: |
|
90 /** Contains the pointers to the safes bags in the PKCS12 PFX Structure*/ |
|
91 RPointerArray<CSafeBagData> iArrayBagData; |
|
92 /** Contains the safe content bag number and the number of bags in it */ |
|
93 RPointerArray<CSafeContentBag> iArraySafecontentBag ; |
|
94 /** Contains the details of the PKCS12 PFX Structure*/ |
|
95 CPfxHeader* iPkcs12Header ; |
|
96 /**contains the integritypassword of the PKCS#12 file */ |
|
97 HBufC* iIntegrityPassword; |
|
98 /**contains the privacy passwords of the PKCS#12 file */ |
|
99 RPointerArray<TDesC>* iPrivacyPassword; |
|
100 /**contains the PKCS#12 data */ |
|
101 HBufC8* iRawData; |
|
102 |
|
103 /**store the safebag number */ |
|
104 TInt iSafebagNumber ; |
|
105 |
|
106 }; |
|
107 |
|
108 #endif |