os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_swicertstoreactions.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_swicertstoreactions.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,223 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-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 +* Actions for testing additional metadata supplied by the SWI cert store, ie
    1.19 +* capabilties, mandatory and systemupgrade flag: - get capabilities - get mandatory - get systemupgrade flag
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file 
    1.26 + @internalTechnology
    1.27 +*/
    1.28 +
    1.29 +#ifndef __T_METADATAACTIONS_H__
    1.30 +#define __T_METADATAACTIONS_H__
    1.31 +
    1.32 +#include "t_certstoreactions.h"
    1.33 +
    1.34 +class CSWICertStore;
    1.35 +
    1.36 +/**
    1.37 + * Test action to initialise an instance of the SWI cert store.
    1.38 + *
    1.39 + * Delete is handled by the standard delete action.
    1.40 + */
    1.41 +class CInitSWICertStoreAction : public CCertStoreTestAction
    1.42 +	{
    1.43 +public:
    1.44 +	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
    1.45 +							 const TTestActionSpec& aTestActionSpec);	
    1.46 +
    1.47 +protected:
    1.48 +	// Implement test action methods
    1.49 +	virtual void PerformAction(TRequestStatus& aStatus);
    1.50 +	virtual void PerformCancel();
    1.51 +	virtual void Reset();
    1.52 +
    1.53 +private:
    1.54 +	CInitSWICertStoreAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
    1.55 +	void ConstructL(const TTestActionSpec& aTestActionSpec);
    1.56 +	
    1.57 +	virtual void DoReportAction();
    1.58 +	virtual void DoCheckResult(TInt aError);
    1.59 +	
    1.60 +private:
    1.61 +	enum TState
    1.62 +		{
    1.63 +		EInitCertStore,
    1.64 +		EFinished
    1.65 +		};
    1.66 +
    1.67 +	TState iState;
    1.68 +	RFs& iFs;
    1.69 +
    1.70 +	};
    1.71 +
    1.72 +/**
    1.73 + * Base class for SWI cert store meta data test actions.
    1.74 + */
    1.75 +class CSWICertStoreTestAction : public CCertStoreTestAction
    1.76 +	{
    1.77 +public:
    1.78 +	virtual ~CSWICertStoreTestAction();
    1.79 +
    1.80 +	// Implement test action methods
    1.81 +	virtual void PerformAction(TRequestStatus& aStatus);
    1.82 +	virtual void PerformCancel();
    1.83 +	virtual void Reset();
    1.84 +
    1.85 +protected:
    1.86 +	CSWICertStoreTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
    1.87 +	void ConstructL(const TTestActionSpec& aTestActionSpec);
    1.88 +
    1.89 +	// Define interface for derived classes
    1.90 +	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec) = 0;
    1.91 +	virtual void DoPerformActionL(CCTCertInfo& aCertInfo) = 0;
    1.92 +	virtual void DoCancel() = 0;
    1.93 +
    1.94 +private:
    1.95 +	enum TState
    1.96 +		{
    1.97 +		EGetCert,
    1.98 +		EPerformAction,
    1.99 +		EFinished
   1.100 +		};
   1.101 +
   1.102 +private:
   1.103 +	CCTCertInfo* FindCertificate();
   1.104 +
   1.105 +private:
   1.106 +	TState iState;
   1.107 +	TCertLabel iCertificateLabel;			///< The certificate we're acting on
   1.108 +	RMPointerArray<CCTCertInfo> iCertInfos; ///< List of all certificates found
   1.109 +	CCertAttributeFilter* iFilter;			///< Filter to use when listing certs
   1.110 +	};
   1.111 +
   1.112 +/**
   1.113 + * Test action to get the capabilties associated with a certificate.
   1.114 + */
   1.115 +class CGetCapabilitiesAction : public CSWICertStoreTestAction
   1.116 +	{
   1.117 +public:
   1.118 +	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
   1.119 +							 const TTestActionSpec& aTestActionSpec);	
   1.120 +	
   1.121 +private:
   1.122 +	CGetCapabilitiesAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
   1.123 +	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
   1.124 +	virtual void DoReportAction();
   1.125 +	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
   1.126 +	virtual void DoCheckResult(TInt aError);
   1.127 +	virtual void DoCancel();
   1.128 +
   1.129 +private:
   1.130 +	TCapabilitySet iExpectedCapapbilities;
   1.131 +	TCapabilitySet iCapabilities;
   1.132 +	};
   1.133 +
   1.134 +/**
   1.135 + * Test action to get the mandatory flag associated with a certificate.
   1.136 + */
   1.137 +class CGetMandatoryAction : public CSWICertStoreTestAction
   1.138 +	{
   1.139 +public:
   1.140 +	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
   1.141 +							 const TTestActionSpec& aTestActionSpec);	
   1.142 +	
   1.143 +private:
   1.144 +	CGetMandatoryAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
   1.145 +	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
   1.146 +	virtual void DoReportAction();
   1.147 +	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
   1.148 +	virtual void DoCheckResult(TInt aError);
   1.149 +	virtual void DoCancel();
   1.150 +
   1.151 +private:
   1.152 +	TBool iExpectedValue;
   1.153 +	TBool iValue;
   1.154 +	};
   1.155 +
   1.156 +/**
   1.157 + * Test action to get the systemupgrade flag associated with a certificate.
   1.158 + */
   1.159 +class CGetSystemUpgradeAction : public CSWICertStoreTestAction
   1.160 +	{
   1.161 +public:
   1.162 +	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
   1.163 +							 const TTestActionSpec& aTestActionSpec);	
   1.164 +	
   1.165 +private:
   1.166 +	CGetSystemUpgradeAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
   1.167 +	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
   1.168 +	virtual void DoReportAction();
   1.169 +	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
   1.170 +	virtual void DoCheckResult(TInt aError);
   1.171 +	virtual void DoCancel();
   1.172 +
   1.173 +private:
   1.174 +	TBool iExpectedSystemUpgradeValue;
   1.175 +	TBool iSystemUpgradeValue;
   1.176 +	};
   1.177 +	
   1.178 +/**
   1.179 +* Test action to get the deletable flag associated with a certificate.
   1.180 +*/
   1.181 + 
   1.182 +class CGetDeletionAction : public CSWICertStoreTestAction
   1.183 +	{
   1.184 +public:
   1.185 +	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
   1.186 +							 const TTestActionSpec& aTestActionSpec);	
   1.187 +	
   1.188 +private:
   1.189 +	CGetDeletionAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
   1.190 +	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
   1.191 +	virtual void DoReportAction();
   1.192 +	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
   1.193 +	virtual void DoCheckResult(TInt aError);
   1.194 +	virtual void DoCancel();
   1.195 +
   1.196 +private:
   1.197 +	TBool iExpectedDeletableValue;
   1.198 +	TBool iDeletableValue;
   1.199 +	};
   1.200 +
   1.201 +/**
   1.202 +* Test action to verify multiple readers
   1.203 +*/
   1.204 + 
   1.205 +class CMultipleReadersAction : public CSWICertStoreTestAction
   1.206 +       {
   1.207 +public:
   1.208 +       static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
   1.209 +                                                        const TTestActionSpec& 
   1.210 +TestActionSpec);       
   1.211 +       
   1.212 +private:
   1.213 +       CMultipleReadersAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
   1.214 +       virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
   1.215 +       virtual void DoReportAction();
   1.216 +       virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
   1.217 +       virtual void DoCheckResult(TInt aError);
   1.218 +       virtual void DoCancel();
   1.219 +
   1.220 +private:
   1.221 +       TBool iExpectedValue;
   1.222 +       TBool iValue; 
   1.223 +       };
   1.224 +	
   1.225 +
   1.226 +#endif