os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_WritableCSDummies.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
*
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 __WRITABLECSDUMMIES_H__
sl@0
    25
#define __WRITABLECSDUMMIES_H__
sl@0
    26
sl@0
    27
sl@0
    28
#include <e32std.h>
sl@0
    29
#include <ct.h>
sl@0
    30
#include <mctwritablecertstore.h>
sl@0
    31
sl@0
    32
sl@0
    33
// this is a helper dummy class just not to 
sl@0
    34
// implement all the interfaces all the time
sl@0
    35
// later we derive two child classes
sl@0
    36
// TNewCSClasswDeletable and TOldCSClasswoDeletable
sl@0
    37
class TWritableCertStoreDummy : public MCTWritableCertStore
sl@0
    38
	{
sl@0
    39
public:	
sl@0
    40
	TWritableCertStoreDummy() : iCertStore(NULL) {};
sl@0
    41
sl@0
    42
// from MCTTokenInterface
sl@0
    43
	virtual MCTToken& Token() { return iCertStore->Token(); };
sl@0
    44
sl@0
    45
// from MCTCertStore
sl@0
    46
	virtual void List(  RMPointerArray<CCTCertInfo>& /*aCerts*/,
sl@0
    47
						const CCertAttributeFilter& /*aFilter*/,
sl@0
    48
						TRequestStatus& /*aStatus*/) {};
sl@0
    49
	virtual void CancelList() {};
sl@0
    50
	virtual void GetCert(CCTCertInfo*& /*aCertInfo*/, 
sl@0
    51
						const TCTTokenObjectHandle& /*aHandle*/, 
sl@0
    52
						TRequestStatus& /*aStatus*/) {};
sl@0
    53
	virtual void CancelGetCert() {};
sl@0
    54
	virtual void Applications(const CCTCertInfo& /*aCertInfo*/, 
sl@0
    55
						RArray<TUid>& /*aApplications*/,
sl@0
    56
						TRequestStatus& /*aStatus*/) {};
sl@0
    57
	virtual void CancelApplications() {};
sl@0
    58
	virtual void IsApplicable(const CCTCertInfo& /*aCertInfo*/, 
sl@0
    59
						TUid /*aApplication*/, 
sl@0
    60
						TBool& /*aIsApplicable*/,
sl@0
    61
						TRequestStatus& /*aStatus*/) {};
sl@0
    62
	virtual void CancelIsApplicable() {};
sl@0
    63
	virtual void Trusted(const CCTCertInfo& /*aCertInfo*/,
sl@0
    64
						TBool& /*aTrusted*/, 
sl@0
    65
						TRequestStatus& /*aStatus*/) {};
sl@0
    66
	virtual void CancelTrusted() {};
sl@0
    67
	virtual void Retrieve(const CCTCertInfo& /*aCertInfo*/, 
sl@0
    68
						TDes8& /*aEncodedCert*/, 
sl@0
    69
						TRequestStatus& /*aStatus*/) {};
sl@0
    70
	virtual void CancelRetrieve() {};
sl@0
    71
sl@0
    72
// from MCTWritableCertStore
sl@0
    73
	// old Add() w/o aDeletable
sl@0
    74
	virtual void Add( const TDesC& /*aLabel*/,
sl@0
    75
						TCertificateFormat /*aFormat*/,
sl@0
    76
						TCertificateOwnerType /*aCertificateOwnerType*/, 
sl@0
    77
						const TKeyIdentifier* /*aSubjectKeyId*/,
sl@0
    78
						const TKeyIdentifier* /*aIssuerKeyId*/,
sl@0
    79
						const TDesC8& /*aCert*/, 
sl@0
    80
						TRequestStatus& /*aStatus*/) {};
sl@0
    81
sl@0
    82
//	here goes new Add(.., const TBool aDeletable, ..) with a deletable param
sl@0
    83
// 	this one DOES HAVE a default implementation in MCTWritableCertStore
sl@0
    84
// 	but not every dummy CS class has its own implementation of this
sl@0
    85
	virtual void Add(const TDesC& aLabel,
sl@0
    86
					 TCertificateFormat aFormat,
sl@0
    87
					 TCertificateOwnerType aCertificateOwnerType, 
sl@0
    88
					 const TKeyIdentifier* aSubjectKeyId,
sl@0
    89
					 const TKeyIdentifier* aIssuerKeyId,
sl@0
    90
					 const TDesC8& aCert, 
sl@0
    91
					 const TBool aDeletable,
sl@0
    92
					 TRequestStatus& aStatus ) 
sl@0
    93
		{ 
sl@0
    94
		MCTWritableCertStore::Add( aLabel, aFormat, aCertificateOwnerType, 
sl@0
    95
						aSubjectKeyId, aIssuerKeyId, aCert, aDeletable, aStatus );
sl@0
    96
		}
sl@0
    97
sl@0
    98
sl@0
    99
	virtual void CancelAdd() {};
sl@0
   100
sl@0
   101
	virtual void Remove(const CCTCertInfo& /*aCertInfo*/, 
sl@0
   102
						TRequestStatus& /*aStatus*/) {};
sl@0
   103
	virtual void CancelRemove() {};
sl@0
   104
sl@0
   105
sl@0
   106
/*  
sl@0
   107
	SETAPPLICABILITY()  - MCTWritableCertStore v.1
sl@0
   108
sl@0
   109
1)	virtual void SetApplicability(const CCTCertInfo& aCertInfo, 
sl@0
   110
							   RArray<TUid>* aApplications, TRequestStatus &aStatus) = 0;
sl@0
   111
sl@0
   112
2)	IMPORT_C void SetApplicability(const CCTCertInfo& aCertInfo, 
sl@0
   113
						  const RArray<TUid>& aApplications, TRequestStatus &aStatus);
sl@0
   114
sl@0
   115
sl@0
   116
	SETAPPLICABILITY  - MCTWritableCertStore v.2
sl@0
   117
sl@0
   118
1)	virtual void SetApplicability(const CCTCertInfo& aCertInfo, 
sl@0
   119
						 const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
sl@0
   120
sl@0
   121
sl@0
   122
	Notice what's done migrating v.1 -> v.2:
sl@0
   123
	1) first method (RArray<TUid>*) is removed, and
sl@0
   124
	2) the 2nd method (const RArray<TUid>&) is made purevirtual
sl@0
   125
*/
sl@0
   126
sl@0
   127
	virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/, 
sl@0
   128
								  RArray<TUid>* /*aApplications*/, 
sl@0
   129
								  TRequestStatus& /*aStatus*/) {};
sl@0
   130
sl@0
   131
	virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/, 
sl@0
   132
						 		  const RArray<TUid>& /*aApplications*/, 
sl@0
   133
						 		  TRequestStatus& /*aStatus*/) {};
sl@0
   134
		
sl@0
   135
		
sl@0
   136
	virtual void CancelSetApplicability() {};
sl@0
   137
	virtual void SetTrust(const CCTCertInfo& /*aCertInfo*/,
sl@0
   138
						TBool /*aTrusted*/, 
sl@0
   139
						TRequestStatus& /*aStatus*/) {};
sl@0
   140
	virtual void CancelSetTrust() {};
sl@0
   141
sl@0
   142
sl@0
   143
private:
sl@0
   144
	MCTCertStore *iCertStore;
sl@0
   145
sl@0
   146
	};		// class TWritableCertStoreDummy
sl@0
   147
	
sl@0
   148
sl@0
   149
sl@0
   150
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . TOldCSClasswoDeletable
sl@0
   151
sl@0
   152
class TOldCSClasswoDeletable : public TWritableCertStoreDummy
sl@0
   153
	{
sl@0
   154
sl@0
   155
public:
sl@0
   156
	TOldCSClasswoDeletable()	{};
sl@0
   157
sl@0
   158
//	doesn't know about new Add(.., const TBool aDeletable, ..) being available
sl@0
   159
// 	thus, uses grandparent's default implementation (returns KErrNotSupported)
sl@0
   160
sl@0
   161
	};		// class TOldCSClasswoDeletable
sl@0
   162
sl@0
   163
sl@0
   164
sl@0
   165
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . TNewCSClasswDeletable
sl@0
   166
sl@0
   167
class TNewCSClasswDeletable : public TWritableCertStoreDummy
sl@0
   168
	{
sl@0
   169
sl@0
   170
public:
sl@0
   171
	TNewCSClasswDeletable()	{};
sl@0
   172
	
sl@0
   173
	// old Add(..) w/o aDeletable
sl@0
   174
	virtual void Add(const TDesC& aLabel,
sl@0
   175
					 TCertificateFormat aFormat,
sl@0
   176
					 TCertificateOwnerType aCertificateOwnerType, 
sl@0
   177
					 const TKeyIdentifier* aSubjectKeyId,
sl@0
   178
					 const TKeyIdentifier* aIssuerKeyId,
sl@0
   179
					 const TDesC8& aCert, 
sl@0
   180
					 TRequestStatus& aStatus ) 
sl@0
   181
		{ 
sl@0
   182
		TWritableCertStoreDummy::Add( aLabel, aFormat, aCertificateOwnerType, 
sl@0
   183
						aSubjectKeyId, aIssuerKeyId, aCert, aStatus );
sl@0
   184
		}
sl@0
   185
sl@0
   186
	// new Add(.., TBool aDeletable, ..) method
sl@0
   187
	virtual void Add( const TDesC& aLabel, 
sl@0
   188
						TCertificateFormat aFormat,
sl@0
   189
						TCertificateOwnerType aCertificateOwnerType, 
sl@0
   190
						const TKeyIdentifier* aSubjectKeyId,
sl@0
   191
						const TKeyIdentifier* aIssuerKeyId,
sl@0
   192
						const TDesC8& aCert, 
sl@0
   193
						const TBool aDeletable,
sl@0
   194
						TRequestStatus& aStatus);
sl@0
   195
sl@0
   196
	};		// class TNewCSClasswDeletable
sl@0
   197
sl@0
   198
sl@0
   199
// new Add(.., TBool aDeletable, ..) implementation
sl@0
   200
void TNewCSClasswDeletable::Add( const TDesC& /*aLabel*/, 
sl@0
   201
							 TCertificateFormat /*aFormat*/,
sl@0
   202
                             TCertificateOwnerType /*aCertificateOwnerType*/, 
sl@0
   203
                             const TKeyIdentifier* /*aSubjectKeyId*/,
sl@0
   204
                             const TKeyIdentifier* /*aIssuerKeyId*/,
sl@0
   205
                             const TDesC8& /*aCert*/, 
sl@0
   206
                             const TBool /*aDeletable*/,
sl@0
   207
                             TRequestStatus& aStatus
sl@0
   208
                             )
sl@0
   209
    {
sl@0
   210
	TRequestStatus* status = &aStatus;	
sl@0
   211
	User::RequestComplete( status, KErrNone );
sl@0
   212
    }
sl@0
   213
sl@0
   214
#endif	//	__WRITABLECSDUMMIES_H__