|
1 /* |
|
2 * Copyright (c) 1998-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalTechnology |
|
24 */ |
|
25 |
|
26 #ifndef __TACTIONVALIDATE_H__ |
|
27 #define __TACTIONVALIDATE_H__ |
|
28 |
|
29 #include <t_testaction.h> |
|
30 #include "tpkixcertval.h" |
|
31 #include <unifiedcertstore.h> |
|
32 #include "tcertutils.h" |
|
33 |
|
34 class CActionValidate : public CTestAction |
|
35 { |
|
36 public: |
|
37 virtual void DoPerformPrerequisite(TRequestStatus& aStatus) = 0; |
|
38 virtual void DoPerformPostrequisite(TRequestStatus& aStatus) = 0; |
|
39 virtual void PerformAction(TRequestStatus& aStatus); |
|
40 TBool TestResult(TInt aError); |
|
41 virtual void PerformCancel(); |
|
42 virtual void AfterOOMFailure(); |
|
43 virtual void Reset(); |
|
44 |
|
45 virtual void DoReportAction(); |
|
46 virtual void DoCheckResult(TInt aError); |
|
47 virtual ~CActionValidate(); |
|
48 protected: |
|
49 void ConstructL(const TTestActionSpec& aTestActionSpec); |
|
50 virtual void CreateChainL() = 0; |
|
51 TBool AddParametersL(const TDesC& aBuf, TInt& aPos); |
|
52 void WritePolicies(const CDesCArray& aPolicySet); |
|
53 CActionValidate(RFs& aFs, CConsoleBase& aConsole,Output& aOut); |
|
54 protected: |
|
55 enum TState |
|
56 { |
|
57 ERemoveCertsBeforeTest, |
|
58 EAddRoot, |
|
59 EAddIntermediateCerts, |
|
60 EDoValidateTestStart, |
|
61 EDoValidateTestValidate, |
|
62 EDoValidateTestValidated, |
|
63 EDoValidateTestFinished, |
|
64 ERemoveCertsAfterTest, |
|
65 EEnd |
|
66 }; |
|
67 |
|
68 TState iState; |
|
69 RFs& iFs; |
|
70 CCertUtils* iCertUtils; |
|
71 |
|
72 CTestChain* iTestChain; |
|
73 CTestParameters* iTestIO; |
|
74 |
|
75 /** |
|
76 * The certificate chain initialized based on whether the certificates are user supplied or to be retrieved |
|
77 * from the certificate store. |
|
78 */ |
|
79 CPKIXCertChain* iChain; |
|
80 |
|
81 /** |
|
82 * The policies extracted from the test case and passed as argument to Validate |
|
83 */ |
|
84 CArrayPtrFlat<HBufC>* iPolicies; |
|
85 |
|
86 /** |
|
87 * The result of the validation test. Used for the validation and the build tests. |
|
88 */ |
|
89 CPKIXValidationResult* iValidationResult; |
|
90 |
|
91 /** |
|
92 * The time, it is used to check if the certifcate is within its validity |
|
93 * period. Used for the validation and the build tests. |
|
94 */ |
|
95 TTime iTime; |
|
96 TBuf<128> iCertPath; |
|
97 }; |
|
98 |
|
99 class CActionValidateWithStore : public CActionValidate |
|
100 { |
|
101 public: |
|
102 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, |
|
103 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
104 static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole, |
|
105 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
106 |
|
107 private: |
|
108 CActionValidateWithStore(RFs& aFs, CConsoleBase& aConsole,Output& aOut); |
|
109 virtual void DoPerformPrerequisite(TRequestStatus& aStatus); |
|
110 virtual void DoPerformPostrequisite(TRequestStatus& aStatus); |
|
111 virtual void CreateChainL(); |
|
112 }; |
|
113 |
|
114 class CActionValidateWithSuppliedCerts : public CActionValidate |
|
115 { |
|
116 public: |
|
117 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, |
|
118 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
119 static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole, |
|
120 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
121 virtual ~CActionValidateWithSuppliedCerts(); |
|
122 private: |
|
123 CActionValidateWithSuppliedCerts(RFs& aFs, CConsoleBase& aConsole,Output& aOut); |
|
124 void ConstructL(const TTestActionSpec& aTestActionSpec); |
|
125 virtual void DoPerformPrerequisite(TRequestStatus& aStatus); |
|
126 virtual void DoPerformPostrequisite(TRequestStatus& aStatus); |
|
127 virtual void CreateChainL(); |
|
128 private: |
|
129 RPointerArray<CX509Certificate>* iRootCerts; |
|
130 HBufC8* iEndEntityAndIntermediateCerts; |
|
131 }; |
|
132 |
|
133 #endif |