Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 1998-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 * PKIXVALIDATIONRESULT.H
16 * Implementation of the class storing PKIX validation result information
28 #ifndef __PKIXVALIDATIONRESULT_H__
29 #define __PKIXVALIDATIONRESULT_H__
31 #include <x509certchain.h>
32 #include <x509certext.h>
36 * Base class for CPKIXValidationResult.
39 class CPKIXValidationResultBase : public CBase
42 /** Creates a new PKIX Validation Result object.
44 * @return The new PKIX Validation Result object. */
45 IMPORT_C static CPKIXValidationResultBase* NewL();
47 /** Creates a new PKIX Validation Result object, and puts a pointer to it onto
50 * @return The new PKIX Validation Result object. */
51 IMPORT_C static CPKIXValidationResultBase* NewLC();
53 /** Creates a new PKIX Validation Result object from a stream.
55 * @return The new PKIX Validation Result object. */
56 IMPORT_C static CPKIXValidationResultBase* NewL(RReadStream& aStream);
58 /** Creates a new PKIX Validation Result object from a stream, and puts a pointer to it onto
61 * @return The new PKIX Validation Result object. */
62 IMPORT_C static CPKIXValidationResultBase* NewLC(RReadStream& aStream);
66 * Frees all resources owned by the object. */
67 IMPORT_C ~CPKIXValidationResultBase();
69 /** Gets the error status of the operation.
71 * Errors are considered fatal, i.e. validation has failed.
73 * @return The error status of the operation. */
74 IMPORT_C const TValidationStatus Error() const;
76 /** Gets a list of warnings generated.
78 * The warnings may or may not be fatal, depending on the context, which the
79 * client is expected to provide.
81 * @return An array of any warnings generated. */
82 IMPORT_C const CArrayFixFlat<TValidationStatus>& Warnings() const;
84 /** Gets a list of all the certificate policies which have been accepted implicitly
85 * in the course of validation.
87 * @return An array of certificate policies. */
88 IMPORT_C const CArrayPtrFlat<CX509CertPolicyInfo>& Policies() const;
90 /** Resets the validation result object to its default values. */
93 /** Sets the error status, and then leaves.
95 * The function uses SetError() to set the error status.
97 * @param aError The error type that occurred when validating the certificate chain.
98 * @param aCert The index number identifying the certificate that gave rise to
100 void SetErrorAndLeaveL(const TValidationError aError, const TInt aCert);
102 /** Sets the error status.
104 * @param aError The error type that occurred when validating the certificate chain.
105 * @param aCert The index number identifying the certificate that gave rise to
107 void SetError(const TValidationError aError, const TInt aCert);
109 /** Adds a warning to the validation result.
111 * @param aWarning The warning to be added. */
112 void AppendWarningL(TValidationStatus aWarning);
114 /** Adds a policy to the validation result.
116 * @param aPolicy The policy to be added. */
117 void AppendPolicyL(CX509CertPolicyInfo& aPolicy);
119 /** Removes all policies from the validation result.
121 * It is used by the validation process to remove policies it has added when
122 * the computation cannot complete because of environmental conditions such as
123 * out of memory, file access failures, etc.. */
124 // (not like signature validation...)
125 void RemovePolicies();
127 // Internalization/Externalization
128 // Externalize. Writes the data out to a stream
129 /** Externalises an object of this class to a write stream.
131 * The presence of this function means that the standard templated operator<<()
132 * can be used to externalise objects of this class.
134 * @param aStream Stream to which the object should be externalised. */
135 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
137 // Internalize. Reads the data from a stream
138 /** Internalises an object of this class from a read stream.
140 * The presence of this function means that the standard templated operator>>()
141 * can be used to internalise objects of this class.
143 * Note that this function has assignment semantics: it replaces the old value
144 * of the object with a new value read from the read stream.
146 * @param aStream Stream from which the object should be internalised. */
147 IMPORT_C void InternalizeL(RReadStream& aStream);
149 /** Returns a list of critical extensions encountered and warnings generated by
150 * certificates during chain validation.
152 * @return An array of certificate warnings. */
153 IMPORT_C const RPointerArray<CCertificateValidationWarnings>& ValidationWarnings() const;
155 /** Adds a certificate warning to the validation result.
157 * @param aCertWarning The warning to be added. */
158 IMPORT_C void AppendCertificateValidationObjectL(const CCertificateValidationWarnings& aCertWarning);
160 /** Adds a critical extension OID warning.
162 * @param aCriticalExt The critical extension OID to be added. */
163 IMPORT_C void AppendCriticalExtensionWarningL(TDesC& aCriticalExt);
166 IMPORT_C CPKIXValidationResultBase();
167 IMPORT_C void ConstructL();
170 TValidationStatus iError;
171 CArrayFixFlat<TValidationStatus>* iWarnings;
172 CArrayPtrFlat<CX509CertPolicyInfo>* iPolicies;
173 RPointerArray<CCertificateValidationWarnings> iCertWarnings;
176 /** Stores the information regarding the results of a validation of a PKIX
182 class CPKIXValidationResult : public CPKIXValidationResultBase
185 /** Creates a new PKIX Validation Result object.
187 * @return The new PKIX Validation Result object. */
188 IMPORT_C static CPKIXValidationResult* NewL();
190 /** Creates a new PKIX Validation Result object, and puts a pointer to it onto
193 * @return The new PKIX Validation Result object. */
194 IMPORT_C static CPKIXValidationResult* NewLC();
198 * Frees all resources owned by the object. */
199 IMPORT_C ~CPKIXValidationResult();
201 /** Gets the error status of the operation.
203 * Errors are considered fatal, i.e. validation has failed.
205 * @return The error status of the operation. */
206 IMPORT_C const TValidationStatus Error() const;
208 /** Gets a list of warnings generated.
210 * The warnings may or may not be fatal, depending on the context, which the
211 * client is expected to provide.
213 * @return An array of any warnings generated. */
214 IMPORT_C const CArrayFixFlat<TValidationStatus>& Warnings() const;
216 /** Gets a list of all the certificate policies which have been accepted implicitly
217 * in the course of validation.
219 * @return An array of certificate policies. */
220 IMPORT_C const CArrayPtrFlat<CX509CertPolicyInfo>& Policies() const;
222 /** Returns a list of critical extensions encountered and warnings generated by
223 * certificates during chain validation. A CCertificateWarning object is returned for
224 * each certificate in the chain, even if no critical extensions or warnings were
225 * encountered. The array's data is in the same order as the certificate chain.
227 * @return An array of certificate warnings. Ownership is not transferred
229 IMPORT_C const RPointerArray<CCertificateValidationWarnings>& ValidationWarnings() const;
232 CPKIXValidationResult();