2 * Copyright (c) 2001-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.
15 * MCTWritableCertStore.h (v.2)
28 #ifndef __MCTWRITABLECERTSTORE_H__
29 #define __MCTWRITABLECERTSTORE_H__
31 #include <mctcertstore.h>
34 * The UID of writeable certificate store interfaces.
36 * A token that supports this interface should also support the read-only certificate
39 const TInt KInterfaceWritableCertStore = 0x102020FB; // new version, since 9.0
42 * Defines the interface for a writeable certificate store token.
44 * This extends the read-only certificate store API in MCTCertStore by adding
45 * functions to add and delete certificates, and to set their applicability and
48 * This documentation describes the security policy that must be enforced by
49 * implementations of the interface.
54 class MCTWritableCertStore : public MCTCertStore
58 * Adding a certificate
62 * Adds a certificate to the store.
64 * This is an asynchronous request.
66 * @param aLabel The label of the certificate to add.
67 * @param aFormat The format of the certificate.
68 * @param aCertificateOwnerType The owner type.
69 * @param aSubjectKeyId The Subject key ID.
70 * @param aIssuerKeyId The issuer key ID.
71 * @param aCert The certificate to be added.
72 * @param aStatus The request status object; contains the result of the Add()
73 * request when complete. Set to KErrCancel, if an outstanding
74 * request is cancelled.
76 * @capability WriteUserData This requires the WriteUserData capability when
77 * applied to user certificates.
78 * @capability WriteDeviceData This requires the WriteDeviceData capability
79 * when applied to CA certificates.
80 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
82 virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
83 TCertificateOwnerType aCertificateOwnerType,
84 const TKeyIdentifier* aSubjectKeyId,
85 const TKeyIdentifier* aIssuerKeyId,
86 const TDesC8& aCert, TRequestStatus& aStatus) = 0;
88 /** Cancels an ongoing Add() operation. */
89 virtual void CancelAdd() = 0;
92 * Removing Certificates
96 * Removes a certificate.
98 * @param aCertInfo The certificate to be removed.
99 * @param aStatus The request status object; contains the result of the Remove()
100 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
102 * @capability WriteUserData This requires the WriteUserData capability when
103 * applied to user certificates.
104 * @capability WriteDeviceData This requires the WriteDeviceData capability
105 * when applied to CA certificates.
106 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
108 virtual void Remove(const CCTCertInfo& aCertInfo, TRequestStatus& aStatus) = 0;
110 /** Cancels an ongoing Remove() operation. */
111 virtual void CancelRemove() = 0;
114 * Setting applicability
118 * Replaces the current applicability settings with the settings in the
121 * This should only be called for CA certificates - it has no meaning for
124 * If this function is called by the unified certstore the given application
125 * uids array is guaranteed not to contain duplicates. However, client
126 * applications may bypass the unified certstore and call this function
127 * directly, in that case the array passed might contain duplicates.
129 * @param aCertInfo The certificate whose applicability should be updated.
130 * @param aApplications The new applicability settings. Ownership of this
131 * remains with the caller, and it must remain valid for the
132 * lifetime of the call.
133 * @param aStatus The request status object; contains the result of the SetApplicability()
134 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
136 * @capability WriteDeviceData This requires the WriteDeviceData capability.
137 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
139 virtual void SetApplicability(const CCTCertInfo& aCertInfo,
140 const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
142 /** Cancels an ongoing SetApplicability() operation. */
143 virtual void CancelSetApplicability() = 0;
146 * Changing trust settings
150 * Changes the trust settings.
152 * A CA certificate is trusted if the user is willing to use it for authenticating
153 * servers. It has no meaning with other types of certificates.
155 * @param aCertInfo The certificate to be updated.
156 * @param aTrusted ETrue, if trusted; EFalse, otherwise.
157 * @param aStatus The request status object; contains the result of the SetTrust()
158 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
160 * @capability WriteDeviceData This requires the WriteDeviceData capability.
161 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
163 virtual void SetTrust(const CCTCertInfo& aCertInfo, TBool aTrusted,
164 TRequestStatus& aStatus) = 0;
166 /** Cancels an ongoing SetTrust() operation. */
167 virtual void CancelSetTrust() = 0;
170 * Adding a certificate
174 * Same as original Add() method above, but with additional parameter TBool aDeletable.
176 * @param aLabel The label of the certificate to add.
177 * @param aFormat The format of the certificate.
178 * @param aCertificateOwnerType The owner type.
179 * @param aSubjectKeyId The Subject key ID.
180 * @param aIssuerKeyId The issuer key ID.
181 * @param aCert The certificate to be added.
183 * @param aDeletable Sets the value for the certificate's deletable flag
184 * = true - means it is permitted to remove the
185 * certificate from certstore
186 * = false - means the certificate is NOT deletable.
188 * @param aStatus The request status object;
189 * contains the result of the Add() request when complete.
190 * Two of possible error values:
191 * = KErrCancel, if an outstanding request is cancelled;
192 * = KErrNotSupported (-5), if the method is called from a
193 * child class that doesn't support implementation of
194 * the new Add() method.
196 * @capability WriteUserData This requires the WriteUserData capability when
197 * applied to user certificates.
198 * @capability WriteDeviceData This requires the WriteDeviceData capability
199 * when applied to CA certificates.
200 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
202 virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
203 TCertificateOwnerType aCertificateOwnerType,
204 const TKeyIdentifier* aSubjectKeyId,
205 const TKeyIdentifier* aIssuerKeyId,
207 const TBool aDeletable,
208 TRequestStatus& aStatus );
213 #include "mctwritablecertstore.inl"