|
1 /* |
|
2 * Copyright (c) 2007-2007 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 "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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef OCSPCLIENT_H |
|
20 #define OCSPCLIENT_H |
|
21 |
|
22 #include "ocspchecker.h" |
|
23 #include <vector> |
|
24 #include <ocsp.h> |
|
25 #include <ocsptransport.h> |
|
26 #include <unifiedcertstore.h> |
|
27 #include <x509cert.h> |
|
28 #include <f32file.h> |
|
29 #include <securitydefs.h> |
|
30 #include "javacommonutils.h" |
|
31 #include "monitor.h" |
|
32 |
|
33 namespace java |
|
34 { |
|
35 namespace security |
|
36 { |
|
37 |
|
38 class OcspResponse: public CBase |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 static OcspResponse* NewL(); |
|
44 void Clear(); |
|
45 virtual ~OcspResponse(); |
|
46 OcspResponse(const OcspResponse&); |
|
47 OcspResponse &operator=(const OcspResponse&); |
|
48 OcspResponse(); |
|
49 |
|
50 private: |
|
51 void ConstructL(); |
|
52 |
|
53 public: |
|
54 |
|
55 int iSummary; |
|
56 std::vector<int> iIndividualResponses; |
|
57 }; |
|
58 |
|
59 class OcspClient : public CActive |
|
60 { |
|
61 |
|
62 enum State |
|
63 { |
|
64 ESendOcspRequest, |
|
65 EProcessOcspResponse |
|
66 }; |
|
67 |
|
68 public: |
|
69 |
|
70 static OcspClient* createInstance(long iap, const char* defaultUrl); |
|
71 void startOcspCheck(const char **, int); |
|
72 OcspResponse getOcspCheckResponse(); |
|
73 void cancelOcspCheck(bool doCleanup); |
|
74 |
|
75 virtual void RunL(); |
|
76 virtual void DoCancel(); |
|
77 virtual TInt RunError(TInt aError); |
|
78 virtual ~OcspClient(); |
|
79 |
|
80 private: |
|
81 OcspClient(long iap); |
|
82 void ConstructL(const char* defaultUrl); |
|
83 void Start(); |
|
84 void SendOcspRequestL(); |
|
85 void ProcessOcspResponse(); |
|
86 void CompleteRequest(); |
|
87 void InitOcspClientL(); |
|
88 TUint32 iIap; |
|
89 HBufC8* iDefaultUrl; |
|
90 State iState; |
|
91 COCSPClient* iOcspClient; |
|
92 CUnifiedCertStore* iCertStore; |
|
93 RFs iRfs; |
|
94 TBool iInitialized; |
|
95 OcspResponse* iOcspResponse; |
|
96 const char ** iCertChain; |
|
97 int iCertChainLen; |
|
98 CArrayPtrFlat<CX509Certificate>* iCertArray; |
|
99 java::util::Monitor* iMonitor; |
|
100 }; |
|
101 |
|
102 } //end namespace security |
|
103 } //end namespace java |
|
104 |
|
105 #endif // OCSPCLIENT_H |