os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_swicertstoreactions.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004-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
* Actions for testing additional metadata supplied by the SWI cert store, ie
sl@0
    16
* capabilties, mandatory and systemupgrade flag: - get capabilities - get mandatory - get systemupgrade flag
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file 
sl@0
    23
 @internalTechnology
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef __T_METADATAACTIONS_H__
sl@0
    27
#define __T_METADATAACTIONS_H__
sl@0
    28
sl@0
    29
#include "t_certstoreactions.h"
sl@0
    30
sl@0
    31
class CSWICertStore;
sl@0
    32
sl@0
    33
/**
sl@0
    34
 * Test action to initialise an instance of the SWI cert store.
sl@0
    35
 *
sl@0
    36
 * Delete is handled by the standard delete action.
sl@0
    37
 */
sl@0
    38
class CInitSWICertStoreAction : public CCertStoreTestAction
sl@0
    39
	{
sl@0
    40
public:
sl@0
    41
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
    42
							 const TTestActionSpec& aTestActionSpec);	
sl@0
    43
sl@0
    44
protected:
sl@0
    45
	// Implement test action methods
sl@0
    46
	virtual void PerformAction(TRequestStatus& aStatus);
sl@0
    47
	virtual void PerformCancel();
sl@0
    48
	virtual void Reset();
sl@0
    49
sl@0
    50
private:
sl@0
    51
	CInitSWICertStoreAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    52
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    53
	
sl@0
    54
	virtual void DoReportAction();
sl@0
    55
	virtual void DoCheckResult(TInt aError);
sl@0
    56
	
sl@0
    57
private:
sl@0
    58
	enum TState
sl@0
    59
		{
sl@0
    60
		EInitCertStore,
sl@0
    61
		EFinished
sl@0
    62
		};
sl@0
    63
sl@0
    64
	TState iState;
sl@0
    65
	RFs& iFs;
sl@0
    66
sl@0
    67
	};
sl@0
    68
sl@0
    69
/**
sl@0
    70
 * Base class for SWI cert store meta data test actions.
sl@0
    71
 */
sl@0
    72
class CSWICertStoreTestAction : public CCertStoreTestAction
sl@0
    73
	{
sl@0
    74
public:
sl@0
    75
	virtual ~CSWICertStoreTestAction();
sl@0
    76
sl@0
    77
	// Implement test action methods
sl@0
    78
	virtual void PerformAction(TRequestStatus& aStatus);
sl@0
    79
	virtual void PerformCancel();
sl@0
    80
	virtual void Reset();
sl@0
    81
sl@0
    82
protected:
sl@0
    83
	CSWICertStoreTestAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    84
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    85
sl@0
    86
	// Define interface for derived classes
sl@0
    87
	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec) = 0;
sl@0
    88
	virtual void DoPerformActionL(CCTCertInfo& aCertInfo) = 0;
sl@0
    89
	virtual void DoCancel() = 0;
sl@0
    90
sl@0
    91
private:
sl@0
    92
	enum TState
sl@0
    93
		{
sl@0
    94
		EGetCert,
sl@0
    95
		EPerformAction,
sl@0
    96
		EFinished
sl@0
    97
		};
sl@0
    98
sl@0
    99
private:
sl@0
   100
	CCTCertInfo* FindCertificate();
sl@0
   101
sl@0
   102
private:
sl@0
   103
	TState iState;
sl@0
   104
	TCertLabel iCertificateLabel;			///< The certificate we're acting on
sl@0
   105
	RMPointerArray<CCTCertInfo> iCertInfos; ///< List of all certificates found
sl@0
   106
	CCertAttributeFilter* iFilter;			///< Filter to use when listing certs
sl@0
   107
	};
sl@0
   108
sl@0
   109
/**
sl@0
   110
 * Test action to get the capabilties associated with a certificate.
sl@0
   111
 */
sl@0
   112
class CGetCapabilitiesAction : public CSWICertStoreTestAction
sl@0
   113
	{
sl@0
   114
public:
sl@0
   115
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
   116
							 const TTestActionSpec& aTestActionSpec);	
sl@0
   117
	
sl@0
   118
private:
sl@0
   119
	CGetCapabilitiesAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   120
	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   121
	virtual void DoReportAction();
sl@0
   122
	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
sl@0
   123
	virtual void DoCheckResult(TInt aError);
sl@0
   124
	virtual void DoCancel();
sl@0
   125
sl@0
   126
private:
sl@0
   127
	TCapabilitySet iExpectedCapapbilities;
sl@0
   128
	TCapabilitySet iCapabilities;
sl@0
   129
	};
sl@0
   130
sl@0
   131
/**
sl@0
   132
 * Test action to get the mandatory flag associated with a certificate.
sl@0
   133
 */
sl@0
   134
class CGetMandatoryAction : public CSWICertStoreTestAction
sl@0
   135
	{
sl@0
   136
public:
sl@0
   137
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
   138
							 const TTestActionSpec& aTestActionSpec);	
sl@0
   139
	
sl@0
   140
private:
sl@0
   141
	CGetMandatoryAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   142
	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   143
	virtual void DoReportAction();
sl@0
   144
	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
sl@0
   145
	virtual void DoCheckResult(TInt aError);
sl@0
   146
	virtual void DoCancel();
sl@0
   147
sl@0
   148
private:
sl@0
   149
	TBool iExpectedValue;
sl@0
   150
	TBool iValue;
sl@0
   151
	};
sl@0
   152
sl@0
   153
/**
sl@0
   154
 * Test action to get the systemupgrade flag associated with a certificate.
sl@0
   155
 */
sl@0
   156
class CGetSystemUpgradeAction : public CSWICertStoreTestAction
sl@0
   157
	{
sl@0
   158
public:
sl@0
   159
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
   160
							 const TTestActionSpec& aTestActionSpec);	
sl@0
   161
	
sl@0
   162
private:
sl@0
   163
	CGetSystemUpgradeAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   164
	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   165
	virtual void DoReportAction();
sl@0
   166
	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
sl@0
   167
	virtual void DoCheckResult(TInt aError);
sl@0
   168
	virtual void DoCancel();
sl@0
   169
sl@0
   170
private:
sl@0
   171
	TBool iExpectedSystemUpgradeValue;
sl@0
   172
	TBool iSystemUpgradeValue;
sl@0
   173
	};
sl@0
   174
	
sl@0
   175
/**
sl@0
   176
* Test action to get the deletable flag associated with a certificate.
sl@0
   177
*/
sl@0
   178
 
sl@0
   179
class CGetDeletionAction : public CSWICertStoreTestAction
sl@0
   180
	{
sl@0
   181
public:
sl@0
   182
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
   183
							 const TTestActionSpec& aTestActionSpec);	
sl@0
   184
	
sl@0
   185
private:
sl@0
   186
	CGetDeletionAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   187
	virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   188
	virtual void DoReportAction();
sl@0
   189
	virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
sl@0
   190
	virtual void DoCheckResult(TInt aError);
sl@0
   191
	virtual void DoCancel();
sl@0
   192
sl@0
   193
private:
sl@0
   194
	TBool iExpectedDeletableValue;
sl@0
   195
	TBool iDeletableValue;
sl@0
   196
	};
sl@0
   197
sl@0
   198
/**
sl@0
   199
* Test action to verify multiple readers
sl@0
   200
*/
sl@0
   201
 
sl@0
   202
class CMultipleReadersAction : public CSWICertStoreTestAction
sl@0
   203
       {
sl@0
   204
public:
sl@0
   205
       static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
sl@0
   206
                                                        const TTestActionSpec& 
sl@0
   207
TestActionSpec);       
sl@0
   208
       
sl@0
   209
private:
sl@0
   210
       CMultipleReadersAction(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   211
       virtual void DoConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   212
       virtual void DoReportAction();
sl@0
   213
       virtual void DoPerformActionL(CCTCertInfo& aCertInfo);
sl@0
   214
       virtual void DoCheckResult(TInt aError);
sl@0
   215
       virtual void DoCancel();
sl@0
   216
sl@0
   217
private:
sl@0
   218
       TBool iExpectedValue;
sl@0
   219
       TBool iValue; 
sl@0
   220
       };
sl@0
   221
	
sl@0
   222
sl@0
   223
#endif