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.
25 #ifndef __MCERTINFO_H__
26 #define __MCERTINFO_H__
28 #include <ct/rmpointerarray.h>
30 // Forward declarations
32 class CCertAttributeFilter;
33 class TCTTokenObjectHandle;
38 * Defines the interface for a read-only certificate store.
40 * This documentation describes the security policy that must be enforced by
41 * implementations of the interface.
47 * Listing Certificates
51 * Get a list of all certificates that satisfy the supplied filter.
53 * This is an async function; all errors are reported by completing aStatus
54 * with the error value, and it can be cancelled with CancelList().
56 * @param aCerts An array into which the returned certificates are placed.
57 * @param aFilter A filter to select which certificates should be included.
58 * @param aStatus A request status that will be completed when the operation completes.
60 virtual void List(RMPointerArray<CCTCertInfo>& aCerts, const CCertAttributeFilter& aFilter,
61 TRequestStatus& aStatus) = 0;
63 /** Cancels an ongoing List() operation. */
64 virtual void CancelList() = 0;
67 * Getting a certificate given a handle.
71 * Get a certificate given its handle.
73 * @param aCertInfo The returned certificate.
74 * @param aHandle The handle of the certificate to return.
75 * @param aStatus The request status object; contains the result of the
76 * GetCert() request when complete. Set to KErrCancel if any outstanding
77 * request is cancelled.
79 virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle,
80 TRequestStatus& aStatus) = 0;
82 /** Cancel an ongoing GetCert() operation. */
83 virtual void CancelGetCert() = 0;
86 * Querying the applications of a certificate.
90 * Get the list of the applications associcated with certificate.
92 * Applications are represented by UIDs. Examples would be Software Install,
93 * TLS, WTLS, WMLScript, SignText, etc..
95 * @param aCertInfo The certificate to return applications for.
96 * @param aAplications An array to save the applications in.
97 * @param aStatus The request status object; contains the result of the
98 * Applications() request when complete. Set to KErrCancel if any
99 * outstanding request is cancelled.
101 virtual void Applications(const CCTCertInfo& aCertInfo, RArray<TUid>& aAplications,
102 TRequestStatus& aStatus) = 0;
104 /** Cancels an ongoing Applications() operation. */
105 virtual void CancelApplications() = 0;
108 * Tests if a certificate is applicable to a particular application.
110 * @param aCertInfo The certificate in question.
111 * @param aApplication The application.
112 * @param aIsApplicable Set to ETrue or EFalse by the function to return the result.
113 * @param aStatus The request status object; contains the result of the
114 * IsApplicable() request when complete. Set to KErrCancel if any
115 * outstanding request is cancelled.
117 virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication,
118 TBool& aIsApplicable, TRequestStatus& aStatus) = 0;
120 /** Cancels an ongoing IsApplicable() operation. */
121 virtual void CancelIsApplicable() = 0;
128 * Tests whether a certificate is trusted.
130 * Trust is only meaningful for CA certificates where it means that the
131 * certificate can be used as a trust root for the purposes of certificate
134 * @param aCertInfo The certificate we are interested in.
135 * @param aTrusted Used to return the trust status.
136 * @param aStatus The request status object; contains the result of the
137 * Trusted() request when complete. Set to KErrCancel if any outstanding
138 * request is cancelled.
140 virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted,
141 TRequestStatus& aStatus) = 0;
143 /** Cancels an ongoing Trusted() operation. */
144 virtual void CancelTrusted() = 0;
147 * Retrieving the actual certificate
151 * Retrieves the actual data of the certificate.
153 * @param aCertInfo The certificate to retrieve.
154 * @param aEncodedCert A buffer to put the certificate in. It must be big
155 * enough; the size is stored in aCertInfo.
156 * @param aStatus The request status object; contains the result of the
157 * Retrieve()request when complete. Set to KErrCancel if any outstanding
158 * request is cancelled.
160 * @capability ReadUserData This requires the ReadUserData capability when
161 * applied to user certificates, as these may contain sensitive user data.
162 * @leave KErrPermissionDenied If called for a user certificate when the
163 * caller doesn't have the ReadUserData capability.
165 virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert,
166 TRequestStatus& aStatus) = 0;
168 /** Cancels an ongoing Retrieve() operation. */
169 virtual void CancelRetrieve() = 0;