sl@0: /* sl@0: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Actions for testing additional metadata supplied by the SWI cert store, ie sl@0: * capabilties, mandatory and systemupgrade flag: - get capabilities - get mandatory - get systemupgrade flag sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __T_METADATAACTIONS_H__ sl@0: #define __T_METADATAACTIONS_H__ sl@0: sl@0: #include "t_certstoreactions.h" sl@0: sl@0: class CSWICertStore; sl@0: sl@0: /** sl@0: * Test action to initialise an instance of the SWI cert store. sl@0: * sl@0: * Delete is handled by the standard delete action. sl@0: */ sl@0: class CInitSWICertStoreAction : public CCertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec); sl@0: sl@0: protected: sl@0: // Implement test action methods sl@0: virtual void PerformAction(TRequestStatus& aStatus); sl@0: virtual void PerformCancel(); sl@0: virtual void Reset(); sl@0: sl@0: private: sl@0: CInitSWICertStoreAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: void ConstructL(const TTestActionSpec& aTestActionSpec); sl@0: sl@0: virtual void DoReportAction(); sl@0: virtual void DoCheckResult(TInt aError); sl@0: sl@0: private: sl@0: enum TState sl@0: { sl@0: EInitCertStore, sl@0: EFinished sl@0: }; sl@0: sl@0: TState iState; sl@0: RFs& iFs; sl@0: sl@0: }; sl@0: sl@0: /** sl@0: * Base class for SWI cert store meta data test actions. sl@0: */ sl@0: class CSWICertStoreTestAction : public CCertStoreTestAction sl@0: { sl@0: public: sl@0: virtual ~CSWICertStoreTestAction(); sl@0: sl@0: // Implement test action methods sl@0: virtual void PerformAction(TRequestStatus& aStatus); sl@0: virtual void PerformCancel(); sl@0: virtual void Reset(); sl@0: sl@0: protected: sl@0: CSWICertStoreTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: void ConstructL(const TTestActionSpec& aTestActionSpec); sl@0: sl@0: // Define interface for derived classes sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec) = 0; sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo) = 0; sl@0: virtual void DoCancel() = 0; sl@0: sl@0: private: sl@0: enum TState sl@0: { sl@0: EGetCert, sl@0: EPerformAction, sl@0: EFinished sl@0: }; sl@0: sl@0: private: sl@0: CCTCertInfo* FindCertificate(); sl@0: sl@0: private: sl@0: TState iState; sl@0: TCertLabel iCertificateLabel; ///< The certificate we're acting on sl@0: RMPointerArray iCertInfos; ///< List of all certificates found sl@0: CCertAttributeFilter* iFilter; ///< Filter to use when listing certs sl@0: }; sl@0: sl@0: /** sl@0: * Test action to get the capabilties associated with a certificate. sl@0: */ sl@0: class CGetCapabilitiesAction : public CSWICertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec); sl@0: sl@0: private: sl@0: CGetCapabilitiesAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec); sl@0: virtual void DoReportAction(); sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo); sl@0: virtual void DoCheckResult(TInt aError); sl@0: virtual void DoCancel(); sl@0: sl@0: private: sl@0: TCapabilitySet iExpectedCapapbilities; sl@0: TCapabilitySet iCapabilities; sl@0: }; sl@0: sl@0: /** sl@0: * Test action to get the mandatory flag associated with a certificate. sl@0: */ sl@0: class CGetMandatoryAction : public CSWICertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec); sl@0: sl@0: private: sl@0: CGetMandatoryAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec); sl@0: virtual void DoReportAction(); sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo); sl@0: virtual void DoCheckResult(TInt aError); sl@0: virtual void DoCancel(); sl@0: sl@0: private: sl@0: TBool iExpectedValue; sl@0: TBool iValue; sl@0: }; sl@0: sl@0: /** sl@0: * Test action to get the systemupgrade flag associated with a certificate. sl@0: */ sl@0: class CGetSystemUpgradeAction : public CSWICertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec); sl@0: sl@0: private: sl@0: CGetSystemUpgradeAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec); sl@0: virtual void DoReportAction(); sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo); sl@0: virtual void DoCheckResult(TInt aError); sl@0: virtual void DoCancel(); sl@0: sl@0: private: sl@0: TBool iExpectedSystemUpgradeValue; sl@0: TBool iSystemUpgradeValue; sl@0: }; sl@0: sl@0: /** sl@0: * Test action to get the deletable flag associated with a certificate. sl@0: */ sl@0: sl@0: class CGetDeletionAction : public CSWICertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec); sl@0: sl@0: private: sl@0: CGetDeletionAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec); sl@0: virtual void DoReportAction(); sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo); sl@0: virtual void DoCheckResult(TInt aError); sl@0: virtual void DoCancel(); sl@0: sl@0: private: sl@0: TBool iExpectedDeletableValue; sl@0: TBool iDeletableValue; sl@0: }; sl@0: sl@0: /** sl@0: * Test action to verify multiple readers sl@0: */ sl@0: sl@0: class CMultipleReadersAction : public CSWICertStoreTestAction sl@0: { sl@0: public: sl@0: static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, sl@0: const TTestActionSpec& sl@0: TestActionSpec); sl@0: sl@0: private: sl@0: CMultipleReadersAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut); sl@0: virtual void DoConstructL(const TTestActionSpec& aTestActionSpec); sl@0: virtual void DoReportAction(); sl@0: virtual void DoPerformActionL(CCTCertInfo& aCertInfo); sl@0: virtual void DoCheckResult(TInt aError); sl@0: virtual void DoCancel(); sl@0: sl@0: private: sl@0: TBool iExpectedValue; sl@0: TBool iValue; sl@0: }; sl@0: sl@0: sl@0: #endif