sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* PKIXCERTCHAIN.H
|
sl@0
|
16 |
* PKIX certificate chain implementation
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
@publishedAll
|
sl@0
|
24 |
@released
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef __PKIXCERTCHAIN_H__
|
sl@0
|
28 |
#define __PKIXCERTCHAIN_H__
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <e32std.h>
|
sl@0
|
31 |
#include <x509certchain.h>
|
sl@0
|
32 |
#include <pkixvalidationresult.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
//implements key validation according to RFC 2459 (PKIX cert/CRL profile), section 6
|
sl@0
|
35 |
class CPKIXValidationState;
|
sl@0
|
36 |
class CPKIXChainBuilder;
|
sl@0
|
37 |
class CPKIXCertChainAO;
|
sl@0
|
38 |
class CPKIXCertChainHelper;
|
sl@0
|
39 |
class MCertStore;
|
sl@0
|
40 |
|
sl@0
|
41 |
/**
|
sl@0
|
42 |
* Base class for CPKIXCertChain
|
sl@0
|
43 |
*/
|
sl@0
|
44 |
class CPKIXCertChainBase : public CX509CertChain
|
sl@0
|
45 |
{
|
sl@0
|
46 |
public:
|
sl@0
|
47 |
//constructors
|
sl@0
|
48 |
/** Creates a certificate chain using the binary data in aEncodedCerts.
|
sl@0
|
49 |
*
|
sl@0
|
50 |
* @param aCertStore The certificate store to use when looking for root certificates.
|
sl@0
|
51 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
52 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
53 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
54 |
* by the chain as intermediate certificates, but not root certificates. The
|
sl@0
|
55 |
* individual certificates can be retrieved since each one contains its own length.
|
sl@0
|
56 |
* @param aClient The Uid identifying the purpose for which the chain will be used.
|
sl@0
|
57 |
* This value will be used to select a subset of stored certificates, by way of their trust
|
sl@0
|
58 |
* settings, to be used as candidate root certificates. */
|
sl@0
|
59 |
IMPORT_C static CPKIXCertChainBase* NewL(MCertStore& aCertStore, const TPtrC8& aEncodedCerts,
|
sl@0
|
60 |
const TUid aClient);
|
sl@0
|
61 |
|
sl@0
|
62 |
/** Creates a certificate chain using the binary data in aEncodedCerts, and puts
|
sl@0
|
63 |
* a pointer to the new object onto the cleanup stack.
|
sl@0
|
64 |
*
|
sl@0
|
65 |
* @param aCertStore The certificate store to use when looking for root certificates.
|
sl@0
|
66 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
67 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
68 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
69 |
* by the chain as intermediate certificates, but not root certificates. The
|
sl@0
|
70 |
* individual certificates can be retrieved since each one contains its own length.
|
sl@0
|
71 |
* @param aClient The Uid identifying the purpose for which the chain will be used.
|
sl@0
|
72 |
* This value will be used to select a subset of stored certificates, by way of their trust
|
sl@0
|
73 |
* settings, to be used as candidate root certificates. */
|
sl@0
|
74 |
IMPORT_C static CPKIXCertChainBase* NewLC(MCertStore& aCertStore, const TPtrC8& aEncodedCerts,
|
sl@0
|
75 |
const TUid aClient);
|
sl@0
|
76 |
|
sl@0
|
77 |
/** Creates a certificate chain using the binary data in aEncodedCerts.
|
sl@0
|
78 |
*
|
sl@0
|
79 |
* @param aCertStore The certificate store to use when looking for root certificates.
|
sl@0
|
80 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
81 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
82 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
83 |
* by the chain as intermediate certificates, but not root certificates. Any
|
sl@0
|
84 |
* self signed certificates supplied here after the first one will be discarded,
|
sl@0
|
85 |
* as self signed certificates cannot by definition be intermediate certificates.
|
sl@0
|
86 |
* The individual certificates can be retrieved since each one contains its own
|
sl@0
|
87 |
* length.
|
sl@0
|
88 |
* @param aRootCerts An array of certificates which the chain will treat as candidate root
|
sl@0
|
89 |
* certificates. If one of these overloads is used, the chain will not look in
|
sl@0
|
90 |
* stores for root certificates, but will only use the certificates supplied here. */
|
sl@0
|
91 |
IMPORT_C static CPKIXCertChainBase* NewL(MCertStore& aCertStore, const TPtrC8& aEncodedCerts,
|
sl@0
|
92 |
const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
93 |
|
sl@0
|
94 |
/** Creates a certificate chain using the binary data in aEncodedCerts and puts
|
sl@0
|
95 |
* a pointer to the new object onto the cleanup stack.
|
sl@0
|
96 |
*
|
sl@0
|
97 |
* @param aCertStore The certificate store to use when looking for root certificates.
|
sl@0
|
98 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
99 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
100 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
101 |
* by the chain as intermediate certificates, but not root certificates. Any
|
sl@0
|
102 |
* self signed certificates supplied here after the first one will be discarded
|
sl@0
|
103 |
* as self signed certificates cannot by definition be intermediate certificates.
|
sl@0
|
104 |
* The individual certificates can be retrieved since each one contains its own
|
sl@0
|
105 |
* length.
|
sl@0
|
106 |
* @param aRootCerts An array of certificates which the chain will treat as candidate root
|
sl@0
|
107 |
* certificates. If one of these overloads is used, the chain will not look in
|
sl@0
|
108 |
* stores for root certificates, but will only use the certificates supplied here. */
|
sl@0
|
109 |
IMPORT_C static CPKIXCertChainBase* NewLC(MCertStore& aCertStore, const TPtrC8& aEncodedCerts,
|
sl@0
|
110 |
const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
111 |
|
sl@0
|
112 |
/** Destructor.
|
sl@0
|
113 |
*
|
sl@0
|
114 |
* Frees all resources owned by the object. */
|
sl@0
|
115 |
IMPORT_C ~CPKIXCertChainBase();
|
sl@0
|
116 |
//validation
|
sl@0
|
117 |
|
sl@0
|
118 |
/** Validates the chain.
|
sl@0
|
119 |
*
|
sl@0
|
120 |
* @param aValidationResult On completion, this contains the result of the validation.
|
sl@0
|
121 |
* @param aValidationTime The time that should be presumed to be the current time when checking timestamps.
|
sl@0
|
122 |
* @param aStatus An asynchronous request status object. */
|
sl@0
|
123 |
IMPORT_C void ValidateL(CPKIXValidationResultBase& aValidationResult,
|
sl@0
|
124 |
const TTime& aValidationTime, TRequestStatus& aStatus);
|
sl@0
|
125 |
|
sl@0
|
126 |
/** Validates the chain.
|
sl@0
|
127 |
*
|
sl@0
|
128 |
* @param aValidationResult On completion, this contains the result of the validation.
|
sl@0
|
129 |
* @param aValidationTime The time that should be presumed to be the current time when checking timestamps.
|
sl@0
|
130 |
* @param aInitialPolicies The policies we want to be present in the certificate chain.
|
sl@0
|
131 |
* @param aStatus An asynchronous request status object. */
|
sl@0
|
132 |
IMPORT_C void ValidateL(CPKIXValidationResultBase& aValidationResult,
|
sl@0
|
133 |
const TTime& aValidationTime, const CArrayPtr<HBufC>& aInitialPolicies,
|
sl@0
|
134 |
TRequestStatus& aStatus);
|
sl@0
|
135 |
|
sl@0
|
136 |
/** Cancels an asynchronous ValidateL() operation. */
|
sl@0
|
137 |
IMPORT_C void CancelValidate();
|
sl@0
|
138 |
|
sl@0
|
139 |
/** Adds one or more intermediate certificates to use when building the chain .
|
sl@0
|
140 |
*
|
sl@0
|
141 |
* Any self signed certs are ignored.
|
sl@0
|
142 |
*
|
sl@0
|
143 |
* @param aEncodedCerts The concatenation of one or more DER encoded X.509 certificates. */
|
sl@0
|
144 |
IMPORT_C void AddCertL(const TPtrC8& aEncodedCerts);
|
sl@0
|
145 |
|
sl@0
|
146 |
/** Tests whether the root certificate of the chain is locatable.
|
sl@0
|
147 |
*
|
sl@0
|
148 |
* Note that the value is only significant after a successful call to ValidateL().
|
sl@0
|
149 |
*
|
sl@0
|
150 |
* @return ETrue if the chain has a root; EFalse, otherwise. */
|
sl@0
|
151 |
IMPORT_C TBool ChainHasRoot() const;
|
sl@0
|
152 |
|
sl@0
|
153 |
/** Returns a list of the critical extension OIDs that are supported by the
|
sl@0
|
154 |
* chain validator. If a critical extension is encountered in a certificate
|
sl@0
|
155 |
* chain whose OID matches an element in this set then the chain validator
|
sl@0
|
156 |
* shall treat this as a warning instead of an error.
|
sl@0
|
157 |
*
|
sl@0
|
158 |
* If CPKIXCertChain::SetSupportedCriticalExtensionsL() has not been called, this
|
sl@0
|
159 |
* list will return the default set of supported critical extensions which
|
sl@0
|
160 |
* includes the X.509 standard and Symbian specific SIS file critical extensions.
|
sl@0
|
161 |
* These extensions may change in the future and should not be relied upon.
|
sl@0
|
162 |
*
|
sl@0
|
163 |
* @return The current list of supported critical extension OIDs. Ownership is not
|
sl@0
|
164 |
* transferred to the caller. */
|
sl@0
|
165 |
IMPORT_C const RPointerArray<TDesC>& SupportedCriticalExtensions() const;
|
sl@0
|
166 |
|
sl@0
|
167 |
/** Adds one or more critical extension OIDs to the list of supported critical
|
sl@0
|
168 |
* extensions. Duplicate OID values are not added.
|
sl@0
|
169 |
*
|
sl@0
|
170 |
* @param aCriticalExtOids A list of the critical extensions OIDs to append to the supported
|
sl@0
|
171 |
* list. Ownership is not transferred from the caller. */
|
sl@0
|
172 |
IMPORT_C void AddSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
173 |
|
sl@0
|
174 |
/** Removes one or more critical extension OIDs from the list of supported critical extensions.
|
sl@0
|
175 |
*
|
sl@0
|
176 |
* @param aCriticalExts A list of the critical extensions OIDs to remove from the supported list.
|
sl@0
|
177 |
* Ownership is with the original caller. Oids will not be destroyed. */
|
sl@0
|
178 |
IMPORT_C void RemoveSupportedCriticalExtensions(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
179 |
|
sl@0
|
180 |
/** Completely replaces the set of supported critical extensions for certificate validation. If a critical
|
sl@0
|
181 |
* extension is encountered matching one of these OIDs then its occurrence is treated as a warning rather
|
sl@0
|
182 |
* than an error. The results of which can be queried through a call to CPKIXValidationResult::ValidationWarnings().
|
sl@0
|
183 |
*
|
sl@0
|
184 |
* @param aCriticalExtOids A list of the critical extensions OIDs for the class to support. Ownership is
|
sl@0
|
185 |
* not transferred from the caller. */
|
sl@0
|
186 |
IMPORT_C void SetSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
187 |
|
sl@0
|
188 |
/** Resets the current list of supported critical extensions and re-populates it with the default set
|
sl@0
|
189 |
* which includes the X.509 standard and Symbian specific SIS file critical extensions. These extensions
|
sl@0
|
190 |
* may change in the future and should not be relied upon. */
|
sl@0
|
191 |
IMPORT_C void ResetSupportedCriticalExtsToDefaultL();
|
sl@0
|
192 |
|
sl@0
|
193 |
/** Specify if a failed check on the certificate validity date is treated as an error or a warning.
|
sl@0
|
194 |
*
|
sl@0
|
195 |
* @param aIsFatal ETrue for reporting as an error; EFalse for a warning.*/
|
sl@0
|
196 |
IMPORT_C void SetValidityPeriodCheckFatal(TBool aIsFatal);
|
sl@0
|
197 |
|
sl@0
|
198 |
/** Returns whether or not validity period check failures will be reported as an error or a warning.
|
sl@0
|
199 |
*
|
sl@0
|
200 |
* @param aIsFatal ETrue if failure is reported as an error; EFalse for a warning.*/
|
sl@0
|
201 |
IMPORT_C TBool ValidityPeriodCheckFatal() const;
|
sl@0
|
202 |
|
sl@0
|
203 |
protected:
|
sl@0
|
204 |
IMPORT_C CPKIXCertChainBase();
|
sl@0
|
205 |
IMPORT_C void ConstructL(MCertStore& aCertStore, const TPtrC8& aEncodedCerts, TUid aClient);
|
sl@0
|
206 |
IMPORT_C void ConstructL(MCertStore& aCertStore, const TPtrC8& aEncodedCerts, const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
207 |
|
sl@0
|
208 |
public:
|
sl@0
|
209 |
// Public non-exported methods called by CPKIXCertChainAO
|
sl@0
|
210 |
CArrayPtrFlat<CX509Certificate>& Chain();
|
sl@0
|
211 |
const RPointerArray<CX509Certificate>& IntermediateCerts();
|
sl@0
|
212 |
TBool ChainHasRoot();
|
sl@0
|
213 |
void RemoveLastCerts(TInt aNumberOfCertsToRemove);
|
sl@0
|
214 |
void SetChainHasRoot(TBool aHasRoot);
|
sl@0
|
215 |
|
sl@0
|
216 |
private:
|
sl@0
|
217 |
void DoConstructL(const TPtrC8& aEncodedCerts);
|
sl@0
|
218 |
|
sl@0
|
219 |
/**
|
sl@0
|
220 |
* This function adds certificates to the chain but only the ones that are not
|
sl@0
|
221 |
* self-signed.
|
sl@0
|
222 |
*
|
sl@0
|
223 |
* @param aEncodedCerts The encoded certificates.
|
sl@0
|
224 |
*/
|
sl@0
|
225 |
void AddIntermediateCertsL(const TPtrC8& aEncodedCerts);
|
sl@0
|
226 |
|
sl@0
|
227 |
private:
|
sl@0
|
228 |
/**
|
sl@0
|
229 |
* Holds a list of candiate intermediate certs - these come from the encoded
|
sl@0
|
230 |
* certs passed at construction time, and also any added with AddCertL().
|
sl@0
|
231 |
*/
|
sl@0
|
232 |
RPointerArray<CX509Certificate> iIntermediateCerts;
|
sl@0
|
233 |
|
sl@0
|
234 |
/**
|
sl@0
|
235 |
* This is ETrue if the chain has a root and EFalse if it hasn't. The value
|
sl@0
|
236 |
* is only significant after a successfull call to ValidateL().
|
sl@0
|
237 |
*/
|
sl@0
|
238 |
TBool iChainHasRoot;
|
sl@0
|
239 |
|
sl@0
|
240 |
/**
|
sl@0
|
241 |
* Most of the fucntionality of the class is asynchronous and is in fact
|
sl@0
|
242 |
* delegated to iActiveObject which will deal with all the asynchronous
|
sl@0
|
243 |
* functions.
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
CPKIXCertChainAO* iActiveObject;
|
sl@0
|
246 |
|
sl@0
|
247 |
/**
|
sl@0
|
248 |
* Holds a list of supported critical extensions set by the client.
|
sl@0
|
249 |
*/
|
sl@0
|
250 |
RPointerArray<TDesC> iSupportedCriticalExts;
|
sl@0
|
251 |
|
sl@0
|
252 |
/**
|
sl@0
|
253 |
* When true (the defaut) indicates that a failed check on the validity period of a
|
sl@0
|
254 |
* certificate will result in a fatal error. When false this instead results in a
|
sl@0
|
255 |
* warning.
|
sl@0
|
256 |
*/
|
sl@0
|
257 |
TBool iDateTimeCheckFatal;
|
sl@0
|
258 |
};
|
sl@0
|
259 |
|
sl@0
|
260 |
|
sl@0
|
261 |
/**
|
sl@0
|
262 |
* This class implements a PKIX certificate chain.
|
sl@0
|
263 |
*
|
sl@0
|
264 |
* @since v6.0
|
sl@0
|
265 |
*/
|
sl@0
|
266 |
class CPKIXCertChain : public CPKIXCertChainBase
|
sl@0
|
267 |
{
|
sl@0
|
268 |
public:
|
sl@0
|
269 |
|
sl@0
|
270 |
//constructors
|
sl@0
|
271 |
/** Creates a certificate chain using the binary data in aEncodedCerts.
|
sl@0
|
272 |
*
|
sl@0
|
273 |
* @param aFs An open file server session.
|
sl@0
|
274 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
275 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
276 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
277 |
* by the chain as intermediate certificates, but not root certificates. The
|
sl@0
|
278 |
* individual certificates can be retrieved since each one contains its own length.
|
sl@0
|
279 |
* @param aClient The Uid identifying the purpose for which the chain will be used.
|
sl@0
|
280 |
* This value will be used to select a subset of stored certificates, by way of their trust
|
sl@0
|
281 |
* settings, to be used as candidate root certificates. */
|
sl@0
|
282 |
IMPORT_C static CPKIXCertChain* NewL(RFs& aFs, const TPtrC8& aEncodedCerts,
|
sl@0
|
283 |
const TUid aClient);
|
sl@0
|
284 |
|
sl@0
|
285 |
/** Creates a certificate chain using the binary data in aEncodedCerts, and puts
|
sl@0
|
286 |
* a pointer to the new object onto the cleanup stack.
|
sl@0
|
287 |
*
|
sl@0
|
288 |
* @param aFs An open file server session
|
sl@0
|
289 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
290 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
291 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
292 |
* by the chain as intermediate certificates, but not root certificates. The
|
sl@0
|
293 |
* individual certificates can be retrieved since each one contains its own length.
|
sl@0
|
294 |
* @param aClient The Uid identifying the purpose for which the chain will be used.
|
sl@0
|
295 |
* This value will be used to select a subset of stored certificates, by way of their trust
|
sl@0
|
296 |
* settings, to be used as candidate root certificates. */
|
sl@0
|
297 |
IMPORT_C static CPKIXCertChain* NewLC(RFs& aFs, const TPtrC8& aEncodedCerts,
|
sl@0
|
298 |
const TUid aClient);
|
sl@0
|
299 |
|
sl@0
|
300 |
/** Creates a certificate chain using the binary data in aEncodedCerts.
|
sl@0
|
301 |
*
|
sl@0
|
302 |
* @param aFs An open file server session.
|
sl@0
|
303 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
304 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
305 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
306 |
* by the chain as intermediate certificates, but not root certificates. Any
|
sl@0
|
307 |
* self signed certificates supplied here after the first one will be discarded,
|
sl@0
|
308 |
* as self signed certificates cannot by definition be intermediate certificates.
|
sl@0
|
309 |
* The individual certificates can be retrieved since each one contains its own
|
sl@0
|
310 |
* length.
|
sl@0
|
311 |
* @param aRootCerts An array of certificates which the chain will treat as candidate root
|
sl@0
|
312 |
* certificates. If one of these overloads is used, the chain will not look in
|
sl@0
|
313 |
* stores for root certificates, but will only use the certificates supplied here. */
|
sl@0
|
314 |
IMPORT_C static CPKIXCertChain* NewL(RFs& aFs, const TPtrC8& aEncodedCerts,
|
sl@0
|
315 |
const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
316 |
|
sl@0
|
317 |
/** Creates a certificate chain using the binary data in aEncodedCerts and puts
|
sl@0
|
318 |
* a pointer to the new object onto the cleanup stack.
|
sl@0
|
319 |
*
|
sl@0
|
320 |
* @param aFs An open file server session.
|
sl@0
|
321 |
* @param aEncodedCerts One or more concatenated DER encoded X.509 certificates.
|
sl@0
|
322 |
* The first certificate will be interpreted as the end entity certificate to
|
sl@0
|
323 |
* be validated; subsequent certificates may be in any order and may be used
|
sl@0
|
324 |
* by the chain as intermediate certificates, but not root certificates. Any
|
sl@0
|
325 |
* self signed certificates supplied here after the first one will be discarded
|
sl@0
|
326 |
* as self signed certificates cannot by definition be intermediate certificates.
|
sl@0
|
327 |
* The individual certificates can be retrieved since each one contains its own
|
sl@0
|
328 |
* length.
|
sl@0
|
329 |
* @param aRootCerts An array of certificates which the chain will treat as candidate root
|
sl@0
|
330 |
* certificates. If one of these overloads is used, the chain will not look in
|
sl@0
|
331 |
* stores for root certificates, but will only use the certificates supplied here. */
|
sl@0
|
332 |
IMPORT_C static CPKIXCertChain* NewLC(RFs& aFs, const TPtrC8& aEncodedCerts,
|
sl@0
|
333 |
const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
334 |
|
sl@0
|
335 |
//destructor
|
sl@0
|
336 |
/** Destructor.
|
sl@0
|
337 |
*
|
sl@0
|
338 |
* Frees all resources owned by the object. */
|
sl@0
|
339 |
IMPORT_C ~CPKIXCertChain();
|
sl@0
|
340 |
//validation
|
sl@0
|
341 |
|
sl@0
|
342 |
/** Validates the chain.
|
sl@0
|
343 |
*
|
sl@0
|
344 |
* @param aValidationResult On completion, this contains the result of the validation.
|
sl@0
|
345 |
* @param aValidationTime The time that should be presumed to be the current time when checking timestamps.
|
sl@0
|
346 |
* @param aStatus An asynchronous request status object. */
|
sl@0
|
347 |
IMPORT_C void ValidateL(CPKIXValidationResult& aValidationResult,
|
sl@0
|
348 |
const TTime& aValidationTime, TRequestStatus& aStatus);
|
sl@0
|
349 |
|
sl@0
|
350 |
/** Validates the chain.
|
sl@0
|
351 |
*
|
sl@0
|
352 |
* @param aValidationResult On completion, this contains the result of the validation.
|
sl@0
|
353 |
* @param aValidationTime The time that should be presumed to be the current time when checking timestamps.
|
sl@0
|
354 |
* @param aInitialPolicies The policies we want to be present in the certificate chain.
|
sl@0
|
355 |
* @param aStatus An asynchronous request status object. */
|
sl@0
|
356 |
IMPORT_C void ValidateL(CPKIXValidationResult& aValidationResult,
|
sl@0
|
357 |
const TTime& aValidationTime, const CArrayPtr<HBufC>& aInitialPolicies,
|
sl@0
|
358 |
TRequestStatus& aStatus);
|
sl@0
|
359 |
|
sl@0
|
360 |
/** Cancels an asynchronous ValidateL() operation. */
|
sl@0
|
361 |
IMPORT_C void CancelValidate();
|
sl@0
|
362 |
|
sl@0
|
363 |
/** Adds a certificate (if it is not self-signed) to the chain .
|
sl@0
|
364 |
*
|
sl@0
|
365 |
* @param aEncodedCerts A DER encoded X.509 certificate. */
|
sl@0
|
366 |
IMPORT_C void AddCertL(const TPtrC8& aEncodedCerts);
|
sl@0
|
367 |
|
sl@0
|
368 |
/** Tests whether the root certificate of the chain is locatable.
|
sl@0
|
369 |
*
|
sl@0
|
370 |
* Note that the value is only significant after a successfull call to ValidateL().
|
sl@0
|
371 |
*
|
sl@0
|
372 |
* @return ETrue if the chain has a root; EFalse, otherwise. */
|
sl@0
|
373 |
IMPORT_C TBool ChainHasRoot() const;
|
sl@0
|
374 |
|
sl@0
|
375 |
/** Returns a list of the critical extension OIDs that are supported by the
|
sl@0
|
376 |
* chain validator. If a critical extension is encountered in a certificate
|
sl@0
|
377 |
* chain whose OID matches an element in this set then the chain validator
|
sl@0
|
378 |
* shall treat this as a warning instead of an error.
|
sl@0
|
379 |
*
|
sl@0
|
380 |
* If CPKIXCertChain::SetSupportedCriticalExtensionsL() has not been called, this
|
sl@0
|
381 |
* list will return the default set of supported critical extensions which
|
sl@0
|
382 |
* includes the X.509 standard and Symbian specific SIS file critical extensions.
|
sl@0
|
383 |
* These extensions may change in the future and should not be relied upon.
|
sl@0
|
384 |
*
|
sl@0
|
385 |
* @return The current list of supported critical extension OIDs. Ownership is not
|
sl@0
|
386 |
* transferred to the caller. */
|
sl@0
|
387 |
IMPORT_C const RPointerArray<TDesC>& SupportedCriticalExtensions() const;
|
sl@0
|
388 |
|
sl@0
|
389 |
/** Adds one or more critical extension OIDs to the list of supported critical
|
sl@0
|
390 |
* extensions. Duplicate OID values are not added.
|
sl@0
|
391 |
*
|
sl@0
|
392 |
* @param aCriticalExtOids A list of the critical extensions OIDs to append to the supported
|
sl@0
|
393 |
* list. Ownership is not transferred from the caller. */
|
sl@0
|
394 |
IMPORT_C void AddSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
395 |
|
sl@0
|
396 |
/** Removes one or more critical extension OIDs from the list of supported critical extensions.
|
sl@0
|
397 |
*
|
sl@0
|
398 |
* @param aCriticalExts A list of the critical extensions OIDs to remove from the supported list.
|
sl@0
|
399 |
* Ownership is with the original caller. Oids will not be destroyed. */
|
sl@0
|
400 |
IMPORT_C void RemoveSupportedCriticalExtensions(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
401 |
|
sl@0
|
402 |
/** Completely replaces the set of supported critical extensions for certificate validation. If a critical
|
sl@0
|
403 |
* extension is encountered matching one of these OIDs then its occurrence is treated as a warning rather
|
sl@0
|
404 |
* than an error. The results of which can be queried through a call to CPKIXValidationResult::ValidationWarnings().
|
sl@0
|
405 |
*
|
sl@0
|
406 |
* @param aCriticalExtOids A list of the critical extensions OIDs for the class to support. Ownership is
|
sl@0
|
407 |
* not transferred from the caller. */
|
sl@0
|
408 |
IMPORT_C void SetSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids);
|
sl@0
|
409 |
|
sl@0
|
410 |
/** Resets the current list of supported critical extensions and re-populates it with the default set
|
sl@0
|
411 |
* which includes the X.509 standard and Symbian specific SIS file critical extensions. These extensions
|
sl@0
|
412 |
* may change in the future and should not be relied upon. */
|
sl@0
|
413 |
IMPORT_C void ResetSupportedCriticalExtsToDefaultL();
|
sl@0
|
414 |
|
sl@0
|
415 |
/** Specify if a failed check on the certificate validity date is treated as an error or a warning.
|
sl@0
|
416 |
*
|
sl@0
|
417 |
* @param aIsFatal ETrue for reporting as an error; EFalse for a warning.*/
|
sl@0
|
418 |
IMPORT_C void SetValidityPeriodCheckFatal(TBool aIsFatal);
|
sl@0
|
419 |
|
sl@0
|
420 |
private:
|
sl@0
|
421 |
CPKIXCertChain();
|
sl@0
|
422 |
void ConstructL(RFs& aFs, const TPtrC8& aEncodedCerts, TUid aClient);
|
sl@0
|
423 |
void ConstructL(RFs& aFs, const TPtrC8& aEncodedCerts,
|
sl@0
|
424 |
const RPointerArray<CX509Certificate>& aRootCerts);
|
sl@0
|
425 |
|
sl@0
|
426 |
private:
|
sl@0
|
427 |
CPKIXCertChainHelper* iHelper;
|
sl@0
|
428 |
};
|
sl@0
|
429 |
|
sl@0
|
430 |
#endif
|