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