os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_WritableCSDummies.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_WritableCSDummies.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,214 @@
     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 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file 
    1.24 + @internalTechnology
    1.25 +*/
    1.26 + 
    1.27 +#ifndef __WRITABLECSDUMMIES_H__
    1.28 +#define __WRITABLECSDUMMIES_H__
    1.29 +
    1.30 +
    1.31 +#include <e32std.h>
    1.32 +#include <ct.h>
    1.33 +#include <mctwritablecertstore.h>
    1.34 +
    1.35 +
    1.36 +// this is a helper dummy class just not to 
    1.37 +// implement all the interfaces all the time
    1.38 +// later we derive two child classes
    1.39 +// TNewCSClasswDeletable and TOldCSClasswoDeletable
    1.40 +class TWritableCertStoreDummy : public MCTWritableCertStore
    1.41 +	{
    1.42 +public:	
    1.43 +	TWritableCertStoreDummy() : iCertStore(NULL) {};
    1.44 +
    1.45 +// from MCTTokenInterface
    1.46 +	virtual MCTToken& Token() { return iCertStore->Token(); };
    1.47 +
    1.48 +// from MCTCertStore
    1.49 +	virtual void List(  RMPointerArray<CCTCertInfo>& /*aCerts*/,
    1.50 +						const CCertAttributeFilter& /*aFilter*/,
    1.51 +						TRequestStatus& /*aStatus*/) {};
    1.52 +	virtual void CancelList() {};
    1.53 +	virtual void GetCert(CCTCertInfo*& /*aCertInfo*/, 
    1.54 +						const TCTTokenObjectHandle& /*aHandle*/, 
    1.55 +						TRequestStatus& /*aStatus*/) {};
    1.56 +	virtual void CancelGetCert() {};
    1.57 +	virtual void Applications(const CCTCertInfo& /*aCertInfo*/, 
    1.58 +						RArray<TUid>& /*aApplications*/,
    1.59 +						TRequestStatus& /*aStatus*/) {};
    1.60 +	virtual void CancelApplications() {};
    1.61 +	virtual void IsApplicable(const CCTCertInfo& /*aCertInfo*/, 
    1.62 +						TUid /*aApplication*/, 
    1.63 +						TBool& /*aIsApplicable*/,
    1.64 +						TRequestStatus& /*aStatus*/) {};
    1.65 +	virtual void CancelIsApplicable() {};
    1.66 +	virtual void Trusted(const CCTCertInfo& /*aCertInfo*/,
    1.67 +						TBool& /*aTrusted*/, 
    1.68 +						TRequestStatus& /*aStatus*/) {};
    1.69 +	virtual void CancelTrusted() {};
    1.70 +	virtual void Retrieve(const CCTCertInfo& /*aCertInfo*/, 
    1.71 +						TDes8& /*aEncodedCert*/, 
    1.72 +						TRequestStatus& /*aStatus*/) {};
    1.73 +	virtual void CancelRetrieve() {};
    1.74 +
    1.75 +// from MCTWritableCertStore
    1.76 +	// old Add() w/o aDeletable
    1.77 +	virtual void Add( const TDesC& /*aLabel*/,
    1.78 +						TCertificateFormat /*aFormat*/,
    1.79 +						TCertificateOwnerType /*aCertificateOwnerType*/, 
    1.80 +						const TKeyIdentifier* /*aSubjectKeyId*/,
    1.81 +						const TKeyIdentifier* /*aIssuerKeyId*/,
    1.82 +						const TDesC8& /*aCert*/, 
    1.83 +						TRequestStatus& /*aStatus*/) {};
    1.84 +
    1.85 +//	here goes new Add(.., const TBool aDeletable, ..) with a deletable param
    1.86 +// 	this one DOES HAVE a default implementation in MCTWritableCertStore
    1.87 +// 	but not every dummy CS class has its own implementation of this
    1.88 +	virtual void Add(const TDesC& aLabel,
    1.89 +					 TCertificateFormat aFormat,
    1.90 +					 TCertificateOwnerType aCertificateOwnerType, 
    1.91 +					 const TKeyIdentifier* aSubjectKeyId,
    1.92 +					 const TKeyIdentifier* aIssuerKeyId,
    1.93 +					 const TDesC8& aCert, 
    1.94 +					 const TBool aDeletable,
    1.95 +					 TRequestStatus& aStatus ) 
    1.96 +		{ 
    1.97 +		MCTWritableCertStore::Add( aLabel, aFormat, aCertificateOwnerType, 
    1.98 +						aSubjectKeyId, aIssuerKeyId, aCert, aDeletable, aStatus );
    1.99 +		}
   1.100 +
   1.101 +
   1.102 +	virtual void CancelAdd() {};
   1.103 +
   1.104 +	virtual void Remove(const CCTCertInfo& /*aCertInfo*/, 
   1.105 +						TRequestStatus& /*aStatus*/) {};
   1.106 +	virtual void CancelRemove() {};
   1.107 +
   1.108 +
   1.109 +/*  
   1.110 +	SETAPPLICABILITY()  - MCTWritableCertStore v.1
   1.111 +
   1.112 +1)	virtual void SetApplicability(const CCTCertInfo& aCertInfo, 
   1.113 +							   RArray<TUid>* aApplications, TRequestStatus &aStatus) = 0;
   1.114 +
   1.115 +2)	IMPORT_C void SetApplicability(const CCTCertInfo& aCertInfo, 
   1.116 +						  const RArray<TUid>& aApplications, TRequestStatus &aStatus);
   1.117 +
   1.118 +
   1.119 +	SETAPPLICABILITY  - MCTWritableCertStore v.2
   1.120 +
   1.121 +1)	virtual void SetApplicability(const CCTCertInfo& aCertInfo, 
   1.122 +						 const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
   1.123 +
   1.124 +
   1.125 +	Notice what's done migrating v.1 -> v.2:
   1.126 +	1) first method (RArray<TUid>*) is removed, and
   1.127 +	2) the 2nd method (const RArray<TUid>&) is made purevirtual
   1.128 +*/
   1.129 +
   1.130 +	virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/, 
   1.131 +								  RArray<TUid>* /*aApplications*/, 
   1.132 +								  TRequestStatus& /*aStatus*/) {};
   1.133 +
   1.134 +	virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/, 
   1.135 +						 		  const RArray<TUid>& /*aApplications*/, 
   1.136 +						 		  TRequestStatus& /*aStatus*/) {};
   1.137 +		
   1.138 +		
   1.139 +	virtual void CancelSetApplicability() {};
   1.140 +	virtual void SetTrust(const CCTCertInfo& /*aCertInfo*/,
   1.141 +						TBool /*aTrusted*/, 
   1.142 +						TRequestStatus& /*aStatus*/) {};
   1.143 +	virtual void CancelSetTrust() {};
   1.144 +
   1.145 +
   1.146 +private:
   1.147 +	MCTCertStore *iCertStore;
   1.148 +
   1.149 +	};		// class TWritableCertStoreDummy
   1.150 +	
   1.151 +
   1.152 +
   1.153 +// . . . . . . . . . . . . . . . . . . . . . . . . . . . . TOldCSClasswoDeletable
   1.154 +
   1.155 +class TOldCSClasswoDeletable : public TWritableCertStoreDummy
   1.156 +	{
   1.157 +
   1.158 +public:
   1.159 +	TOldCSClasswoDeletable()	{};
   1.160 +
   1.161 +//	doesn't know about new Add(.., const TBool aDeletable, ..) being available
   1.162 +// 	thus, uses grandparent's default implementation (returns KErrNotSupported)
   1.163 +
   1.164 +	};		// class TOldCSClasswoDeletable
   1.165 +
   1.166 +
   1.167 +
   1.168 +// . . . . . . . . . . . . . . . . . . . . . . . . . . . . TNewCSClasswDeletable
   1.169 +
   1.170 +class TNewCSClasswDeletable : public TWritableCertStoreDummy
   1.171 +	{
   1.172 +
   1.173 +public:
   1.174 +	TNewCSClasswDeletable()	{};
   1.175 +	
   1.176 +	// old Add(..) w/o aDeletable
   1.177 +	virtual void Add(const TDesC& aLabel,
   1.178 +					 TCertificateFormat aFormat,
   1.179 +					 TCertificateOwnerType aCertificateOwnerType, 
   1.180 +					 const TKeyIdentifier* aSubjectKeyId,
   1.181 +					 const TKeyIdentifier* aIssuerKeyId,
   1.182 +					 const TDesC8& aCert, 
   1.183 +					 TRequestStatus& aStatus ) 
   1.184 +		{ 
   1.185 +		TWritableCertStoreDummy::Add( aLabel, aFormat, aCertificateOwnerType, 
   1.186 +						aSubjectKeyId, aIssuerKeyId, aCert, aStatus );
   1.187 +		}
   1.188 +
   1.189 +	// new Add(.., TBool aDeletable, ..) method
   1.190 +	virtual void Add( const TDesC& aLabel, 
   1.191 +						TCertificateFormat aFormat,
   1.192 +						TCertificateOwnerType aCertificateOwnerType, 
   1.193 +						const TKeyIdentifier* aSubjectKeyId,
   1.194 +						const TKeyIdentifier* aIssuerKeyId,
   1.195 +						const TDesC8& aCert, 
   1.196 +						const TBool aDeletable,
   1.197 +						TRequestStatus& aStatus);
   1.198 +
   1.199 +	};		// class TNewCSClasswDeletable
   1.200 +
   1.201 +
   1.202 +// new Add(.., TBool aDeletable, ..) implementation
   1.203 +void TNewCSClasswDeletable::Add( const TDesC& /*aLabel*/, 
   1.204 +							 TCertificateFormat /*aFormat*/,
   1.205 +                             TCertificateOwnerType /*aCertificateOwnerType*/, 
   1.206 +                             const TKeyIdentifier* /*aSubjectKeyId*/,
   1.207 +                             const TKeyIdentifier* /*aIssuerKeyId*/,
   1.208 +                             const TDesC8& /*aCert*/, 
   1.209 +                             const TBool /*aDeletable*/,
   1.210 +                             TRequestStatus& aStatus
   1.211 +                             )
   1.212 +    {
   1.213 +	TRequestStatus* status = &aStatus;	
   1.214 +	User::RequestComplete( status, KErrNone );
   1.215 +    }
   1.216 +
   1.217 +#endif	//	__WRITABLECSDUMMIES_H__