os/security/cryptoservices/certificateandkeymgmt/tpkcs12intgrtn/inc/tpkcs12data.h
First public contribution.
2 * Copyright (c) 2005-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 * This file contains the classes CPfxHeader,CSafeBagAttribute ,CSafeContentBag ,CSafeBagData.
24 #ifndef __TPKCS12DATA_H
25 #define __TPKCS12DATA_H
31 using namespace PKCS12;
34 To store the PKCS12 file details
36 class CPfxHeader : public CBase
41 /** creates a CPfxHeader object*/
42 static CPfxHeader* NewL(const CDecPkcs12& aDecPkcs12 , TInt aError);
43 /** creates a CPfxHeader object, push it on Cleanupstack*/
44 static CPfxHeader* NewLC(const CDecPkcs12& aDecPkcs12 , TInt aError);
47 /** to set the contentinfo count */
48 inline void SetContentInfoCount(TInt aContentInfoCount){iContentInfoCount = aContentInfoCount;}
49 /** to increment the keybagcount */
50 inline void IncrementKeyBagCount(){iKeyBagCount++ ;}
51 /** to increment the shroudedskeybagcount */
52 inline void IncrementShroudedKeyBagCount(){iShroudedKeyBagCount++ ;}
53 /** to increment the certbagcount */
54 inline void IncrementCertBagCount(){iCertBagCount++;}
55 /** to increment the crlbagcount */
56 inline void IncrementCrlBagCount(){iCrlBagCount++;}
57 /** to increment the secretbagcount */
58 inline void IncrementSecretBagCount(){iSecretBagCount++;}
59 /** to increment the safecontentbagcount */
60 inline void IncrementSafecontentBagCount(){iSafeContentsBagCount++;}
61 /** to set the pkcs12 Main Class ExpectedError */
62 inline void SetPkcs12ActualError(TInt aPkcs12ActualError){iPkcs12ActualError = aPkcs12ActualError;}
63 /** to get the version number*/
64 inline TInt Version(){return iVersion;}
65 /** to get the integrity mode*/
66 inline CDecPkcs12::TIntegrityMode IntegrityMode(){return iIntegrityMode;}
67 /** to get the mac data presence */
68 inline TBool MacData(){return iIsMacDataPresent;}
69 /** to get the mac Id */
70 inline TDesC8& MacId(){return *iMac;}
71 /** to get the mac salt */
72 inline TDesC8& MacSalt(){return *iMacSalt;}
73 /** to get the iteration count */
74 inline TInt IterationCount(){return iIterationCount;}
75 /** to get the contentinfo count */
76 inline TInt ContentInfoCount(){return iContentInfoCount;}
77 /** to get the keybagcount */
78 inline TInt KeyBagCount(){return iKeyBagCount;}
80 /** to get the shroudedskeybagcount */
81 inline TInt ShroudedKeyBagCount(){return iShroudedKeyBagCount;}
82 /** to get the certbagcount */
83 inline TInt CertBagCount(){return iCertBagCount;}
84 /** to get the crlbagcount */
85 inline TInt CrlBagCount(){return iCrlBagCount;}
86 /** to append the secretbagcount */
87 inline TInt SecretBagCount(){return iSecretBagCount;}
88 /** to append the safecontentbagcount */
89 inline TInt SafecontentBagCount(){return iSafeContentsBagCount;}
90 inline TInt TotalSafeBagCount(){return (iKeyBagCount+iShroudedKeyBagCount+
91 iCertBagCount+iCrlBagCount+iSecretBagCount);}
93 /** to get the pkcs12 Main Class ExpectedError */
94 inline TInt Pkcs12ActualError(){return iPkcs12ActualError;}
96 void ConstructL(const CDecPkcs12& aDecPkcs12 , TInt aError);
98 /** contains the version number of the PKCS#12 file */
100 /** contains the integrity mode of the PKCS#12 file */
101 CDecPkcs12::TIntegrityMode iIntegrityMode;
102 /** contains 1 if macData is present else 0 */
103 TBool iIsMacDataPresent;
104 /** contains the mac ID */
106 /** contains the mac salt */
108 /** contains the iteration count */
109 TInt iIterationCount ;
110 /** contains the total content info count in the PKCS#12 file */
111 TInt iContentInfoCount;
112 /** contains the total keybag count in the PKCS#12 file */
114 /** contains the total shroudedkeybag count in the PKCS#12 file */
115 TInt iShroudedKeyBagCount;
116 /** contains the total certbag count in the PKCS#12 file */
118 /** contains the total crlbag count in the PKCS#12 file */
120 /** contains the total secretbag count in the PKCS#12 file */
121 TInt iSecretBagCount;
122 /** contains the total safecontent bag count in the PKCS#12 file */
123 TInt iSafeContentsBagCount;
124 /** contains PKCS12 main class error */
125 TInt iPkcs12ActualError;
132 To store the safecag attribute details
135 class CSafeBagAttribute : public CBase
139 ~CSafeBagAttribute();
140 /** creates a CSafeBagAttribute object*/
141 static CSafeBagAttribute* NewL(const CDecPkcs12Attribute& aAttribute);
142 /** creates a CSafeBagAttribute object, push it on Cleanupstack*/
143 static CSafeBagAttribute* NewLC(const CDecPkcs12Attribute& aAttribute);
145 /** to set the Attribute Id */
146 inline void SetAttributeId(const TDesC& aAttributeId){iAttrId = aAttributeId.AllocL();}
147 /** to set the Attribute value count */
148 inline void SetAttributeValueCount(TInt aAttributeValCount){iAttrValCount = aAttributeValCount;}
150 /** to get the Attribute Id */
151 inline const TDesC& AttributeId(){return *iAttrId;}
152 /** to get the Attribute value count */
153 inline TInt AttributeValueCount(){return iAttrValCount;}
158 void ConstructL(const CDecPkcs12Attribute& aAttribute);
159 /**contains the attribute id*/
161 /**contains the attributes count*/
166 To store the safecontent bag details
168 class CSafeContentBag : public CBase
172 /** creates a CSafeContentBag object*/
173 static CSafeContentBag* NewL();
174 /** creates a CSafeContentBag object, push it on Cleanupstack*/
175 static CSafeContentBag* NewLC();
177 /** to set the safecontent bag number */
178 inline void SetBagNumber(TInt aBagNumber){iBagNumber = aBagNumber;}
179 /** to set the safebagcount in the safecontent bag*/
180 inline void SetSafeBagCount(TInt aSafeBagCount){iSafeBagCount = aSafeBagCount;}
182 /** to get the safecontent bag number */
183 inline TInt BagNumber(){return iBagNumber;}
184 /** to get the safebagcount in the safecontent bag*/
185 inline TInt SafeBagCount(){return iSafeBagCount;}
191 /** contains the safecontent bag number in the PKCS#12 file*/
193 /** contains the safebag count in the safecontent bag*/
201 To store the Safebag details
203 class CSafeBagData : public CBase
206 /** creates a CSafeBagData object */
207 static CSafeBagData* NewL();
208 /** creates a CSafeBagData object, push it on Cleanupstack*/
209 static CSafeBagData* NewLC();
213 /** to set the contentinfo number corresponding to the bag*/
214 inline void SetContentInfoNumber(TInt aContentInfo){iContentInfo = aContentInfo;}
215 /** to set the contenttype corresponding to the bag*/
216 inline void SetContentInfoType(TInt aContentType){iContentType = aContentType;}
217 /** to set the bag number corresponding to the bag*/
218 inline void SetBagNumber(TInt aBagNumber){iBagNumber = aBagNumber;}
219 /** to set the PrivateKeyInfoVersion corresponding to the bag*/
220 inline void SetPrivateKeyInfoVersion(TInt aPrivateKeyInfoVersion){iPrivateKeyInfoVersion = aPrivateKeyInfoVersion;}
221 /** to set the bag id corresponding to the bag*/
222 inline void SetBagType(CDecPkcs12SafeBag::TBagId aBagId){iBagId = aBagId;}
223 /** to set the bag value corresponding to the bag*/
224 inline void SetBagValue(const TDesC8& aBagValue){iBagValue = aBagValue.AllocL();}
225 /** to set the Algorithem id corresponding to the bag*/
226 inline void SetAlgorithmId(const TDesC& aAlgorithmId){iAlgorithmID = aAlgorithmId.AllocL();}
227 /** to set the Certificate id corresponding to the certbag*/
228 inline void SetCertificateId(const TDesC& aCertificateID){iCertificateID = aCertificateID.AllocL();}
229 /** to set the key type corresponding to the bag*/
230 inline void SetKeyType(TAlgorithmId aKeyType){iKeyType = aKeyType;}
232 /** to set the X509Certificate corresponding to the bag*/
233 inline void SetX509Certificate(const CX509Certificate* aX509Certificate){iX509certificate = aX509Certificate;}
234 /** to set the DerEncodedShroudedKey */
235 inline void SetEncodedShroudedKey(const TDesC8& aEncodedShroudedKey){iEncodedShroudedKey = aEncodedShroudedKey.AllocL();}
237 /** to get the contentinfo number corresponding to the bag*/
238 inline TInt ContentInfoNumber(){return iContentInfo;}
239 /** to get the contenttype corresponding to the bag*/
240 inline TInt ContentInfoType(){return iContentType ;}
241 /** to get the bag number corresponding to the bag*/
242 inline TInt BagNumber(){return iBagNumber;}
243 /** to get the PrivateKeyInfoVersion corresponding to the bag*/
244 inline TInt PrivateKeyInfoVersion(){return iPrivateKeyInfoVersion;}
245 /** to get the bag id corresponding to the bag*/
246 inline CDecPkcs12SafeBag::TBagId BagType(){return iBagId;}
247 /** to get the bag value corresponding to the bag*/
248 inline const TDesC8& BagValue(){return *iBagValue;}
249 /** to get the Algorithem id corresponding to the bag*/
250 inline const TDesC& AlgorithmId(){return *iAlgorithmID ;}
251 /** to get the Certificate id corresponding to the certbag*/
252 inline const TDesC& CertificateId(){return *iCertificateID ;}
253 /** to get the key type corresponding to the bag*/
254 inline TAlgorithmId KeyType(){return iKeyType;}
255 /** to get the X509Certificate corresponding to the bag*/
256 inline const CX509Certificate& X509Certificate(){return *iX509certificate;}
257 /** to get the DerEncodedShroudedKey*/
258 inline TDesC8& EncodedShroudedKey(){return *iEncodedShroudedKey;}
260 /** contains the attribute IDs and attribute values count*/
261 RPointerArray<CSafeBagAttribute> iAttributeIDs;
262 /** contains the attribute values */
263 RPointerArray<HBufC8> iAttributeValues;
266 /** contains the content info number of the safebag */
268 /** contains the content type of the safebag */
270 /** contains the bag number of the safebag */
272 /** contains the privatekey info version of the safebag */
273 TInt iPrivateKeyInfoVersion ;
274 /** contains the bag ID of the safebag */
275 CDecPkcs12SafeBag::TBagId iBagId;
276 /** contains the bag value of the safebag */
278 /** contains the algorithem ID */
280 /** contains the certificate ID */
281 HBufC* iCertificateID;
282 /** contains the key type */
283 TAlgorithmId iKeyType;
285 /** contains the X509Certificate */
286 const CX509Certificate* iX509certificate;
287 /*contains the der encoded shrouded key */
288 HBufC8* iEncodedShroudedKey;
293 TAlgorithmId iAlgortihmId;