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