1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tpkixcert/tactionvalidate.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,132 @@
1.4 +/*
1.5 +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalTechnology
1.25 +*/
1.26 +
1.27 +#ifndef __TACTIONVALIDATE_H__
1.28 +#define __TACTIONVALIDATE_H__
1.29 +
1.30 +#include "t_testaction.h"
1.31 +#include "tpkixcertval.h"
1.32 +#include <unifiedcertstore.h>
1.33 +#include "tcertutils.h"
1.34 +
1.35 +class CActionValidate : public CTestAction
1.36 +{
1.37 +public:
1.38 + virtual void DoPerformPrerequisite(TRequestStatus& aStatus) = 0;
1.39 + virtual void DoPerformPostrequisite(TRequestStatus& aStatus) = 0;
1.40 + virtual void PerformAction(TRequestStatus& aStatus);
1.41 + TBool TestResult(TInt aError);
1.42 + virtual void PerformCancel();
1.43 + virtual void AfterOOMFailure();
1.44 + virtual void Reset();
1.45 +
1.46 + virtual void DoReportAction();
1.47 + virtual void DoCheckResult(TInt aError);
1.48 + virtual ~CActionValidate();
1.49 +protected:
1.50 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.51 + virtual void CreateChainL() = 0;
1.52 + TBool AddParametersL(const TDesC& aBuf, TInt& aPos);
1.53 + void WritePolicies(const CDesCArray& aPolicySet);
1.54 + CActionValidate(RFs& aFs, CConsoleBase& aConsole,Output& aOut);
1.55 +protected:
1.56 + enum TState
1.57 + {
1.58 + ERemoveCertsBeforeTest,
1.59 + EAddRoot,
1.60 + EAddIntermediateCerts,
1.61 + EDoValidateTestStart,
1.62 + EDoValidateTestValidate,
1.63 + EDoValidateTestValidated,
1.64 + EDoValidateTestFinished,
1.65 + ERemoveCertsAfterTest,
1.66 + EEnd
1.67 + };
1.68 +
1.69 + TState iState;
1.70 + RFs& iFs;
1.71 + CCertUtils* iCertUtils;
1.72 +
1.73 + CTestChain* iTestChain;
1.74 + CTestParameters* iTestIO;
1.75 +
1.76 + /**
1.77 + * The certificate chain initialized based on whether the certificates are user supplied or to be retrieved
1.78 + * from the certificate store.
1.79 + */
1.80 + CPKIXCertChain* iChain;
1.81 +
1.82 + /**
1.83 + * The policies extracted from the test case and passed as argument to Validate
1.84 + */
1.85 + CArrayPtrFlat<HBufC>* iPolicies;
1.86 +
1.87 + /**
1.88 + * The result of the validation test. Used for the validation and the build tests.
1.89 + */
1.90 + CPKIXValidationResult* iValidationResult;
1.91 +
1.92 + /**
1.93 + * The time, it is used to check if the certifcate is within its validity
1.94 + * period. Used for the validation and the build tests.
1.95 + */
1.96 + TTime iTime;
1.97 + TBuf<128> iCertPath;
1.98 +};
1.99 +
1.100 +class CActionValidateWithStore : public CActionValidate
1.101 + {
1.102 +public:
1.103 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.104 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.105 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.106 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.107 +
1.108 +private:
1.109 + CActionValidateWithStore(RFs& aFs, CConsoleBase& aConsole,Output& aOut);
1.110 + virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
1.111 + virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
1.112 + virtual void CreateChainL();
1.113 + };
1.114 +
1.115 +class CActionValidateWithSuppliedCerts : public CActionValidate
1.116 + {
1.117 +public:
1.118 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.119 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.120 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.121 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.122 + virtual ~CActionValidateWithSuppliedCerts();
1.123 +private:
1.124 + CActionValidateWithSuppliedCerts(RFs& aFs, CConsoleBase& aConsole,Output& aOut);
1.125 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.126 + virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
1.127 + virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
1.128 + virtual void CreateChainL();
1.129 +private:
1.130 + RPointerArray<CX509Certificate>* iRootCerts;
1.131 + HBufC8* iEndEntityAndIntermediateCerts;
1.132 + };
1.133 +
1.134 +#endif
1.135 +