|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * CPKIXCertChainHelper class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 */ |
|
26 |
|
27 #ifndef __PKIXCERTCHAINHELPER_H__ |
|
28 #define __PKIXCERTCHAINHELPER_H__ |
|
29 |
|
30 #include <e32base.h> |
|
31 |
|
32 class RFs; |
|
33 class CPKIXCertChainBase; |
|
34 class CPKIXValidationResult; |
|
35 class CUnifiedCertStore; |
|
36 |
|
37 /** |
|
38 * An helper object that used to implement the valdiation functionality of the |
|
39 * CPKICCertChain interface. This is done by creating and initialising a |
|
40 * unified certificate store, and then calling through to the implementation in |
|
41 * CPKIXCertChainBase. |
|
42 */ |
|
43 NONSHARABLE_CLASS(CPKIXCertChainHelper) : public CActive |
|
44 { |
|
45 public: |
|
46 static CPKIXCertChainHelper* NewL(RFs& aFs); |
|
47 |
|
48 virtual ~CPKIXCertChainHelper(); |
|
49 |
|
50 CUnifiedCertStore& CertStore(); |
|
51 |
|
52 /** Validates the chain. */ |
|
53 void Validate(CPKIXCertChainBase& aCertChain, |
|
54 CPKIXValidationResult& aValidationResult, |
|
55 const TTime& aValidationTime, |
|
56 TRequestStatus& aStatus); |
|
57 |
|
58 /** Validates the chain. */ |
|
59 void Validate(CPKIXCertChainBase& aCertChain, |
|
60 CPKIXValidationResult& aValidationResult, |
|
61 const TTime& aValidationTime, |
|
62 const CArrayPtr<HBufC>& aInitialPolicies, |
|
63 TRequestStatus& aStatus); |
|
64 |
|
65 /** Cancels an asynchronous Validate() operation. */ |
|
66 void CancelValidate(); |
|
67 |
|
68 private: |
|
69 CPKIXCertChainHelper(); |
|
70 void ConstructL(RFs& aFs); |
|
71 void StartValidate(CPKIXCertChainBase& aCertChain, |
|
72 CPKIXValidationResult& aValidationResult, |
|
73 const TTime& aValidationTime, |
|
74 const CArrayPtr<HBufC>* aInitialPolicies, |
|
75 TRequestStatus& aStatus); |
|
76 void InitializeCertStore(); |
|
77 void ValidateChainL(); |
|
78 |
|
79 private: |
|
80 virtual void RunL(); |
|
81 virtual TInt RunError(TInt aError); |
|
82 virtual void DoCancel(); |
|
83 void Complete(TInt aError); |
|
84 |
|
85 private: |
|
86 enum TState |
|
87 { |
|
88 EIdle, |
|
89 EInitializeCertStore, |
|
90 EValidateChain |
|
91 }; |
|
92 |
|
93 CUnifiedCertStore* iCertStore; |
|
94 TBool iCertStoreInitialized; |
|
95 TState iState; |
|
96 |
|
97 // Client parameters |
|
98 CPKIXCertChainBase* iCertChain; |
|
99 CPKIXValidationResult* iValidationResult; |
|
100 TTime iValidationTime; |
|
101 const CArrayPtr<HBufC>* iInitialPolicies; |
|
102 TRequestStatus* iClientStatus; |
|
103 }; |
|
104 |
|
105 #endif |