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