os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_WritableCSDummies.h
First public contribution.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
24 #ifndef __WRITABLECSDUMMIES_H__
25 #define __WRITABLECSDUMMIES_H__
30 #include <mctwritablecertstore.h>
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
40 TWritableCertStoreDummy() : iCertStore(NULL) {};
42 // from MCTTokenInterface
43 virtual MCTToken& Token() { return iCertStore->Token(); };
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*/,
65 TRequestStatus& /*aStatus*/) {};
66 virtual void CancelTrusted() {};
67 virtual void Retrieve(const CCTCertInfo& /*aCertInfo*/,
68 TDes8& /*aEncodedCert*/,
69 TRequestStatus& /*aStatus*/) {};
70 virtual void CancelRetrieve() {};
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*/) {};
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,
91 const TBool aDeletable,
92 TRequestStatus& aStatus )
94 MCTWritableCertStore::Add( aLabel, aFormat, aCertificateOwnerType,
95 aSubjectKeyId, aIssuerKeyId, aCert, aDeletable, aStatus );
99 virtual void CancelAdd() {};
101 virtual void Remove(const CCTCertInfo& /*aCertInfo*/,
102 TRequestStatus& /*aStatus*/) {};
103 virtual void CancelRemove() {};
107 SETAPPLICABILITY() - MCTWritableCertStore v.1
109 1) virtual void SetApplicability(const CCTCertInfo& aCertInfo,
110 RArray<TUid>* aApplications, TRequestStatus &aStatus) = 0;
112 2) IMPORT_C void SetApplicability(const CCTCertInfo& aCertInfo,
113 const RArray<TUid>& aApplications, TRequestStatus &aStatus);
116 SETAPPLICABILITY - MCTWritableCertStore v.2
118 1) virtual void SetApplicability(const CCTCertInfo& aCertInfo,
119 const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
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
127 virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/,
128 RArray<TUid>* /*aApplications*/,
129 TRequestStatus& /*aStatus*/) {};
131 virtual void SetApplicability(const CCTCertInfo& /*aCertInfo*/,
132 const RArray<TUid>& /*aApplications*/,
133 TRequestStatus& /*aStatus*/) {};
136 virtual void CancelSetApplicability() {};
137 virtual void SetTrust(const CCTCertInfo& /*aCertInfo*/,
139 TRequestStatus& /*aStatus*/) {};
140 virtual void CancelSetTrust() {};
144 MCTCertStore *iCertStore;
146 }; // class TWritableCertStoreDummy
150 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . TOldCSClasswoDeletable
152 class TOldCSClasswoDeletable : public TWritableCertStoreDummy
156 TOldCSClasswoDeletable() {};
158 // doesn't know about new Add(.., const TBool aDeletable, ..) being available
159 // thus, uses grandparent's default implementation (returns KErrNotSupported)
161 }; // class TOldCSClasswoDeletable
165 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . TNewCSClasswDeletable
167 class TNewCSClasswDeletable : public TWritableCertStoreDummy
171 TNewCSClasswDeletable() {};
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,
180 TRequestStatus& aStatus )
182 TWritableCertStoreDummy::Add( aLabel, aFormat, aCertificateOwnerType,
183 aSubjectKeyId, aIssuerKeyId, aCert, aStatus );
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,
193 const TBool aDeletable,
194 TRequestStatus& aStatus);
196 }; // class TNewCSClasswDeletable
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
210 TRequestStatus* status = &aStatus;
211 User::RequestComplete( status, KErrNone );
214 #endif // __WRITABLECSDUMMIES_H__