os/security/cryptomgmtlibs/cryptotokenfw/inc_interfaces/mctwritablecertstore_v2.h
First public contribution.
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)
26 #ifndef __MCTWRITABLECERTSTORE_H__
27 #define __MCTWRITABLECERTSTORE_H__
29 #include <mctcertstore.h>
32 * The UID of writeable certificate store interfaces.
34 * A token that supports this interface should also support the read-only certificate
37 const TInt KInterfaceWritableCertStore = 0x102020FB; // new version, since 9.0
40 * Defines the interface for a writeable certificate store token.
42 * This extends the read-only certificate store API in MCTCertStore by adding
43 * functions to add and delete certificates, and to set their applicability and
46 * This documentation describes the security policy that must be enforced by
47 * implementations of the interface.
52 class MCTWritableCertStore : public MCTCertStore
56 * Adding a certificate
60 * Adds a certificate to the store.
62 * This is an asynchronous request.
64 * @param aLabel The label of the certificate to add.
65 * @param aFormat The format of the certificate.
66 * @param aCertificateOwnerType The owner type.
67 * @param aSubjectKeyId The Subject key ID.
68 * @param aIssuerKeyId The issuer key ID.
69 * @param aCert The certificate to be added.
70 * @param aStatus The request status object; contains the result of the Add()
71 * request when complete. Set to KErrCancel, if an outstanding
72 * request is cancelled.
74 * @capability WriteUserData This requires the WriteUserData capability when
75 * applied to user certificates.
76 * @capability WriteDeviceData This requires the WriteDeviceData capability
77 * when applied to CA certificates.
78 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
80 virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
81 TCertificateOwnerType aCertificateOwnerType,
82 const TKeyIdentifier* aSubjectKeyId,
83 const TKeyIdentifier* aIssuerKeyId,
84 const TDesC8& aCert, TRequestStatus& aStatus) = 0;
86 /** Cancels an ongoing Add() operation. */
87 virtual void CancelAdd() = 0;
90 * Removing Certificates
94 * Removes a certificate.
96 * @param aCertInfo The certificate to be removed.
97 * @param aStatus The request status object; contains the result of the Remove()
98 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
100 * @capability WriteUserData This requires the WriteUserData capability when
101 * applied to user certificates.
102 * @capability WriteDeviceData This requires the WriteDeviceData capability
103 * when applied to CA certificates.
104 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
106 virtual void Remove(const CCTCertInfo& aCertInfo, TRequestStatus& aStatus) = 0;
108 /** Cancels an ongoing Remove() operation. */
109 virtual void CancelRemove() = 0;
112 * Setting applicability
116 * Replaces the current applicability settings with the settings in the
119 * This should only be called for CA certificates - it has no meaning for
122 * If this function is called by the unified certstore the given application
123 * uids array is guaranteed not to contain duplicates. However, client
124 * applications may bypass the unified certstore and call this function
125 * directly, in that case the array passed might contain duplicates.
127 * @param aCertInfo The certificate whose applicability should be updated.
128 * @param aApplications The new applicability settings. Ownership of this
129 * remains with the caller, and it must remain valid for the
130 * lifetime of the call.
131 * @param aStatus The request status object; contains the result of the SetApplicability()
132 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
134 * @capability WriteDeviceData This requires the WriteDeviceData capability.
135 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
137 virtual void SetApplicability(const CCTCertInfo& aCertInfo,
138 const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
140 /** Cancels an ongoing SetApplicability() operation. */
141 virtual void CancelSetApplicability() = 0;
144 * Changing trust settings
148 * Changes the trust settings.
150 * A CA certificate is trusted if the user is willing to use it for authenticating
151 * servers. It has no meaning with other types of certificates.
153 * @param aCertInfo The certificate to be updated.
154 * @param aTrusted ETrue, if trusted; EFalse, otherwise.
155 * @param aStatus The request status object; contains the result of the SetTrust()
156 * request when complete. Set to KErrCancel, if an outstanding request is cancelled.
158 * @capability WriteDeviceData This requires the WriteDeviceData capability.
159 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
161 virtual void SetTrust(const CCTCertInfo& aCertInfo, TBool aTrusted,
162 TRequestStatus& aStatus) = 0;
164 /** Cancels an ongoing SetTrust() operation. */
165 virtual void CancelSetTrust() = 0;
168 * Adding a certificate
172 * Same as original Add() method above, but with additional parameter TBool aDeletable.
174 * @param aLabel The label of the certificate to add.
175 * @param aFormat The format of the certificate.
176 * @param aCertificateOwnerType The owner type.
177 * @param aSubjectKeyId The Subject key ID.
178 * @param aIssuerKeyId The issuer key ID.
179 * @param aCert The certificate to be added.
181 * @param aDeletable Sets the value for the certificate's deletable flag
182 * = true - means it is permitted to remove the
183 * certificate from certstore
184 * = false - means the certificate is NOT deletable.
186 * @param aStatus The request status object;
187 * contains the result of the Add() request when complete.
188 * Two of possible error values:
189 * = KErrCancel, if an outstanding request is cancelled;
190 * = KErrNotSupported (-5), if the method is called from a
191 * child class that doesn't support implementation of
192 * the new Add() method.
194 * @capability WriteUserData This requires the WriteUserData capability when
195 * applied to user certificates.
196 * @capability WriteDeviceData This requires the WriteDeviceData capability
197 * when applied to CA certificates.
198 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
200 virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
201 TCertificateOwnerType aCertificateOwnerType,
202 const TKeyIdentifier* aSubjectKeyId,
203 const TKeyIdentifier* aIssuerKeyId,
205 const TBool aDeletable,
206 TRequestStatus& aStatus );
211 #include <mctwritablecertstore.inl>