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