First public contribution.
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 * CWTLSCertChainAO class implementation
25 #ifndef __WTLSCERTCHAINAO_H__
26 #define __WTLSCERTCHAINAO_H__
30 #include <unifiedcertstore.h>
35 class CWTLSValidationResult;
36 class CWTLSCertificate;
39 * This class handles the asynchronous part of the wtls chain validation. It
40 * is an active object which handles the asynchronous certificate store operations.
42 class CWTLSCertChainAO : public CActive
45 static CWTLSCertChainAO* NewL(RFs& aFs, CWTLSCertChain &aWTLSCertChain,
46 const CArrayPtr<CWTLSCertificate>& aRootCerts);
47 static CWTLSCertChainAO* NewL(RFs& aFs, CWTLSCertChain &aWTLSCertChain,
49 virtual ~CWTLSCertChainAO();
50 virtual TInt RunError(TInt aError);
53 CWTLSCertChainAO(RFs& aFs, CWTLSCertChain &aWTLSCertChain);
54 CWTLSCertChainAO(RFs& aFs, CWTLSCertChain &aWTLSCertChain, const TUid aClient);
55 void ConstructL(const CArrayPtr<CWTLSCertificate>& aRootCerts);
63 * This function creates a CCertStoreManager,
64 * calls CCertStoreManager initialise and sets the state
65 * to EStoreManagerInitialized
67 void HandleEStoreManagerInitializationL();
68 void HandleEStoreManagerInitializedL();
69 void HandleEGetCertHashesL();
70 void HandleEPruneListL();
71 void HandleEPruneListDoneL();
72 void HandleECheckTCAL();
73 void HandleEIsChainSelfSignedL();
74 void HandleERetrieveRootsL();
75 void HandleEAddRootToListL();
76 void HandleEFindRootL();
77 void HandleEValidateEndL();
81 void Validate(CWTLSValidationResult& aValidationResult, const TTime& aValidationTime,
82 TRequestStatus& aStatus);
85 TBool CheckSignatureAndNameL(const CWTLSCertificate& aCert,
86 CWTLSValidationResult& aResult, TInt aPos) const;
87 TBool CheckValidityPeriod(const CWTLSCertificate& aCert,
88 CWTLSValidationResult& aResult, const TTime aTime, TInt aPos) const;
89 HBufC8& GeneratePublicKeyHashL(const CWTLSCertificate& aCert) const;
93 EStoreManagerInitialization = 0,
94 EStoreManagerInitialized,
108 CUnifiedCertStore* iCertStoreManager;
110 * List of the subject hashes from the cert store
111 * The elements remained owned by the CCTCertInfo
113 RPointerArray< TBuf8<20> > iRootSubjectStoreHashList;
115 * List of the subject hashes from the passed in certs
116 * We own this object and all its elements
118 RPointerArray< HBufC8 > iRootSubjectClientHashList;
119 CCertAttributeFilter* iFilter;
121 * Stores info on the certs in the cert store
122 * We own this object and all its elements
124 RMPointerArray<CCTCertInfo> iCertInfos;
126 * Indicates whether iWTLSCertChain.iChain was pruned or not
130 * The index within iChain that the chain was pruned
132 TInt iPrunedChainLength;
134 CWTLSCertChain& iWTLSCertChain;
137 HBufC8* iEncodedCertTemp;
141 TRequestStatus* iOriginalRequestStatus;
144 * Roots passed in from the client that we trust
145 * We own this object and all its elements
147 RPointerArray<CWTLSCertificate> iRootsFromClient;
149 * Roots from the specified cert store that we trust.
150 * We own this object and all its elements
152 RPointerArray<CWTLSCertificate> iRootsFromStore;
155 * A counter used to carry counter information between AO states
160 * Indicates if a root cert has been found for this particular chain
165 * To store the parameters passed to CWTLSCertChain::Validate
167 CWTLSValidationResult* iValidationResult;
169 * To store the parameters passed to CWTLSCertChain::Validate
171 const TTime* iValidationTime;
174 #include <wtlscertchain.h>