os/security/cryptoservices/certificateandkeymgmt/tpkcs12intgrtn/inc/tpkcs12libteststep.h
Update contrib.
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 contains the Teststep class which is used for verification of the pkcs12 file
26 #ifndef __TPKCS12LIBTESTSTEP01_H__
27 #define __TPKCS12LIBTESTSTEP01_H__
30 #include <test/testexecutestepbase.h>
33 #include "tpkcs12common.h"
36 const TInt KPositiveTest=1;
37 const TInt KNegativeTest=0;
38 const TInt KBagDataSecBufLen=10;
39 const TInt KPrivacyPwdStrLen=17;
40 const TInt KContentInfoBufLen=12;
41 const TInt KPasswordKeyStrLen=15;
42 const TInt KBagDataSectionStrLen=7;
43 const TInt KContentInfoKeyStrLen=11;
44 const TInt KAttributeBufLen=6;
45 const TInt KAttributeKeyStrLen=4;
46 const TInt KBagValBufLen=8;
47 const TInt KBagValKeyStrLen=5;
49 _LIT(KFriendlyNameOid,"1.2.840.113549.1.9.20");
50 _LIT(KLocalKeyOid,"1.2.840.113549.1.9.21");
51 _LIT(KMainSec,"main");
52 _LIT(KAuthSafeSec,"authsafe");
53 _LIT(KFilePath,"file");
54 _LIT(KIntegrityMode,"integritymode");
55 _LIT(KUnitTest,"unittest");
56 _LIT(KUnitTestValue,"FALSE");
57 _LIT(KPassword,"password");
58 _LIT(KIntegrityPassword,"integritypassword");
59 _LIT(KIntegrityValid,"integrity_valid");
60 _LIT(KPublicIntegrity,"public");
61 _LIT(KPrivacyPassword,"PrivacyPassword");
62 _LIT(KExpectedResult,"ExpectedResult");
63 _LIT(KVerifyIntgPass,"verifyintegritypassword");
64 _LIT(KMacPresent,"MacPresent");
65 _LIT(KMacValueDefault,"FALSE");
66 _LIT(KMacTestValue,"True");
67 _LIT(KContentInfoKey,"contentinfo");
68 _LIT(KContentInfoNum,"numcontentinfos");
69 _LIT(KBagDataSec,"BagData");
70 _LIT(KBagType,"BagType");
71 _LIT(KSafeBagsCount,"SafeBagsCount");
72 _LIT(KContentInfoType,"ContentInfoType");
73 _LIT(KBagAttributesKey,"attr");
74 _LIT(KBagAttributesNum,"numattributes");
75 _LIT(KBagAttributesID,"id");
76 _LIT(KBagAttributeValuesNum,"numvalues");
77 _LIT(KBagAttributeValue,"value");
78 _LIT(KAlgorithm,"Algorithm");
79 _LIT(KCertType,"CertType");
80 _LIT(KContentInfoPwd,"ContentInfoPrivacyPassword");
81 _LIT(KSafeBagPrivacyPwd,"safeBagprivacypassword");
82 _LIT(KBagValue,"BagValue");
83 _LIT(KEncBagValue,"EncodedBagValue");
85 _LIT(KMacSalt,"MacSalt");
86 _LIT(KIterationCount,"IterationCount");
87 _LIT(KIntegrityPwd,"integritypassword");
88 _LIT(KExpectedError,"ExpectedError");
90 _LIT(KFriendlyName,"1.2.840.113549.1.9.20");
91 _LIT(KLocalKey,"1.2.840.113549.1.9.21");
95 This is a teststep class wherin all the verification for the pkcs12 file
98 class CPKCS12LibTestStep : public CTestStep
101 CPKCS12LibTestStep ();
102 ~CPKCS12LibTestStep();
103 //From CTestStep class
104 TVerdict doTestStepL();
107 TBool ChkCIType(TDesC &aSecName,CSafeBagData &aBagData);
108 TBool ChkBagType(TDesC &aSecName,CSafeBagData &aBagData,TInt aBagId);
109 TBool ChkBagAttbutesL(TDesC &aSecName,CSafeBagData &aBagData);
110 TBool ChkAtrSecL(TDesC &aSec,CSafeBagData &aBagData,TInt aIndx);
111 TBool ChkAtrValL(TDesC &aSecName,CSafeBagData &aBagData,TInt aNumVal);
112 TBool ChkAlgId(TDesC &aSecName,CSafeBagData &aBagData);
113 TBool ChkCertId(TDesC &aSecName,CSafeBagData &aBagData);
114 TBool VerifyMainSecL();
115 TBool VerifyAuthSafe();
116 TBool ChkBagDataL(TInt aTotalsafebags,TInt aTotalbags);
117 TBool ChkSafeContsBagData(TDesC& aBagSec,CSafeContentBag &aSafeContntBagData);
118 TBool ChkBagValL(TDesC &aSecName,CSafeBagData &aBagData);
119 TBool ChkMacValueL();
120 TBool CompareFileDataL(TDesC &aPValue,TDesC8 &aBufferVal);
121 void ParsePrivacyPwdL();
122 TBool VerifyExpectedError(const TDesC &aSecName);
123 TBool ChkEncodedBagValL(TDesC &aSecName,CSafeBagData &aBagData);
126 /** privacy password of all the contentinfos in sequence if encrypted */
127 RPointerArray<TDesC>iPrivacyPassword ;
128 /** SafeBagData pointer */
129 CSafeBagData *iBagData;
130 /** positive or negative test */
131 TBool iExpectedResult;
132 /** flag for checking whether the verification function returns true or false */
134 /** Unit test value */
136 /** BagAttribute Value */
138 /** Argument error. */
140 /** ContentData is Set 0, if the contentData is absent. */
141 TInt iContentDataPresent;
142 /** PKCS12Parser object */
143 CPkcs12Parser *iParser;
144 /** File server object */
146 /** Set to True/False depending on the verification of the error. */
147 TBool iUnitTestContinueFlag;
152 This is a teststep class wherin all the OOM Test for the pkcs12 library
155 class CTPKCS12OOMStep : public CTestStep
160 // From CTestStep class
161 TVerdict doTestStepPreambleL();
162 TVerdict doTestStepL();
164 HBufC8* ReadFileDataL(TPtrC tag);
166 /** contains the data */
168 /** contains the authsafe data */
169 HBufC8* iAuthSafeData;
170 /** File server object */
174 _LIT(KStep, "PKCS12LibTestStep");
175 _LIT(KTPKCS12OOMStep,"PKCS12OOMTestStep");