|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CERTTOOL_COMMANDS_H_ |
|
20 #define __CERTTOOL_COMMANDS_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <ct/rmpointerarray.h> |
|
24 #include <unifiedcertstore.h> |
|
25 #include <badesca.h> |
|
26 //#include <e32cmn.h> |
|
27 |
|
28 #include <keytool.rsg> |
|
29 |
|
30 #include "keytool_commands.h" |
|
31 |
|
32 class CCertToolController; |
|
33 |
|
34 /** |
|
35 * Interface that every keytool command class must implement. |
|
36 */ |
|
37 class CCertToolCommand : public CActive |
|
38 { |
|
39 public: |
|
40 virtual void DoCommandL(CUnifiedCertStore& aCertStore, CKeyToolParameters* aParam) = 0; |
|
41 |
|
42 protected: |
|
43 CCertToolCommand(CCertToolController* aController); |
|
44 |
|
45 protected: |
|
46 CCertToolController* iController; |
|
47 CKeyToolParameters* iParams; // we do not own this! |
|
48 }; |
|
49 |
|
50 |
|
51 /** |
|
52 * Implements the certtool display usage action. |
|
53 */ |
|
54 class CCertToolUsage : public CCertToolCommand |
|
55 { |
|
56 public: |
|
57 static CCertToolUsage* NewLC(CCertToolController* aController); |
|
58 static CCertToolUsage* NewL(CCertToolController* aController); |
|
59 ~CCertToolUsage(); |
|
60 void ConstructL(); |
|
61 |
|
62 public: // From CCertToolCommand |
|
63 void DoCommandL(CUnifiedCertStore& aCertStore, CKeyToolParameters* aParam); |
|
64 |
|
65 public: // From CActive |
|
66 void RunL(); |
|
67 void DoCancel(); |
|
68 |
|
69 protected: |
|
70 CCertToolUsage(CCertToolController* aController); |
|
71 }; |
|
72 |
|
73 |
|
74 /** |
|
75 * Implements the certtool display usage action. |
|
76 */ |
|
77 class CCertToolListStores : public CCertToolCommand |
|
78 { |
|
79 public: |
|
80 static CCertToolListStores* NewLC(CCertToolController* aController); |
|
81 static CCertToolListStores* NewL(CCertToolController* aController); |
|
82 ~CCertToolListStores(); |
|
83 void ConstructL(); |
|
84 |
|
85 public: // From CCertToolCommand |
|
86 void DoCommandL(CUnifiedCertStore& aCertStore, CKeyToolParameters* aParam); |
|
87 |
|
88 public: // From CActive |
|
89 void RunL(); |
|
90 void DoCancel(); |
|
91 |
|
92 protected: |
|
93 CCertToolListStores(CCertToolController* aController); |
|
94 |
|
95 private: |
|
96 RArray<MCTCertStore> iCertStoreList; |
|
97 }; |
|
98 |
|
99 |
|
100 typedef RArray<TUid> RUidArray; |
|
101 |
|
102 /** |
|
103 * Implements the keytool list action. This is an active object as listing is asynchronous. |
|
104 */ |
|
105 class CCertToolList : public CCertToolCommand |
|
106 { |
|
107 public: |
|
108 static CCertToolList* NewLC(CCertToolController* aController); |
|
109 static CCertToolList* NewL(CCertToolController* aController); |
|
110 ~CCertToolList(); |
|
111 void ConstructL(); |
|
112 |
|
113 public: // From CCertToolCommand |
|
114 void DoCommandL(CUnifiedCertStore& aCertStore, CKeyToolParameters* aParam); |
|
115 |
|
116 public: // From CActive |
|
117 void RunL(); |
|
118 void DoCancel(); |
|
119 TInt RunError(TInt aError); |
|
120 |
|
121 protected: |
|
122 CCertToolList(CCertToolController* aController); |
|
123 |
|
124 protected: |
|
125 CUnifiedCertStore* iCertStore; |
|
126 MCertStore* iCertStoreImp; |
|
127 |
|
128 TInt iIndex; |
|
129 CCertificate* iCertificate; |
|
130 |
|
131 RUidArray iApps; |
|
132 RArray<RUidArray> iCertApps; |
|
133 RPointerArray<CCertificate> iParsedCerts; |
|
134 RMPointerArray<CCTCertInfo> iCertInfos; |
|
135 CCertAttributeFilter* iFilter; |
|
136 |
|
137 enum TState |
|
138 { |
|
139 EListCerts, |
|
140 ERetrieve, |
|
141 EGetApps, |
|
142 ESetTrust, |
|
143 EFinished, |
|
144 EIntermediate |
|
145 } iState; |
|
146 }; |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 /** |
|
152 * Implements the keytool import action. |
|
153 */ |
|
154 class CCertToolAdd : public CCertToolCommand |
|
155 { |
|
156 public: |
|
157 static CCertToolAdd* NewLC(CCertToolController* aController); |
|
158 static CCertToolAdd* NewL(CCertToolController* aController); |
|
159 ~CCertToolAdd(); |
|
160 void ConstructL(); |
|
161 |
|
162 public: // From CKeyToolCommand |
|
163 void DoCommandL(CUnifiedCertStore& aCertStore, CKeyToolParameters* aParam); |
|
164 |
|
165 public: // From CActive |
|
166 void RunL(); |
|
167 void DoCancel(); |
|
168 TInt RunError(TInt aError); |
|
169 |
|
170 private: |
|
171 CCertToolAdd(CCertToolController* aController); |
|
172 |
|
173 TCertificateFormat DoRecognizeL(const TDesC8& iData); |
|
174 |
|
175 protected: |
|
176 enum TState |
|
177 { |
|
178 EIntermediate, |
|
179 EFinish |
|
180 } iState; |
|
181 |
|
182 private: |
|
183 HBufC8* iCertData; |
|
184 CUnifiedCertStore* iCertStore; |
|
185 }; |
|
186 |
|
187 |
|
188 |
|
189 /** |
|
190 * Implements the certtool remove action. |
|
191 */ |
|
192 class CCertToolRemove : public CCertToolList |
|
193 { |
|
194 public: |
|
195 static CCertToolRemove* NewLC(CCertToolController* aController); |
|
196 static CCertToolRemove* NewL(CCertToolController* aController); |
|
197 ~CCertToolRemove(); |
|
198 |
|
199 public: // From CActive |
|
200 void RunL(); |
|
201 |
|
202 protected: |
|
203 |
|
204 private: |
|
205 CCertToolRemove(CCertToolController* aController); |
|
206 |
|
207 private: |
|
208 |
|
209 }; |
|
210 |
|
211 |
|
212 /** |
|
213 * |
|
214 */ |
|
215 class CCertToolSetApps : public CCertToolList |
|
216 { |
|
217 public: |
|
218 static CCertToolSetApps* NewLC(CCertToolController* aController); |
|
219 static CCertToolSetApps* NewL(CCertToolController* aController); |
|
220 ~CCertToolSetApps(); |
|
221 |
|
222 public: // From CActive |
|
223 void RunL(); |
|
224 TInt RunError(TInt aError); |
|
225 protected: |
|
226 |
|
227 private: |
|
228 CCertToolSetApps(CCertToolController* aController); |
|
229 TInt iCertIndex; |
|
230 TBool iCaCert; |
|
231 }; |
|
232 |
|
233 |
|
234 /** |
|
235 * |
|
236 */ |
|
237 class CCertToolAddApps : public CCertToolList |
|
238 { |
|
239 public: |
|
240 static CCertToolAddApps* NewLC(CCertToolController* aController); |
|
241 static CCertToolAddApps* NewL(CCertToolController* aController); |
|
242 ~CCertToolAddApps(); |
|
243 |
|
244 public: // From CActive |
|
245 void RunL(); |
|
246 TInt RunError(TInt aError); |
|
247 |
|
248 protected: |
|
249 enum TState |
|
250 { |
|
251 EListCerts, |
|
252 ERetrieve, |
|
253 EGetApps, |
|
254 ESetApps, |
|
255 EFinished, |
|
256 EIntermediate |
|
257 } iState; |
|
258 |
|
259 private: |
|
260 CCertToolAddApps(CCertToolController* aController); |
|
261 |
|
262 }; |
|
263 |
|
264 /** |
|
265 * |
|
266 */ |
|
267 class CCertToolRemoveApps : public CCertToolList |
|
268 { |
|
269 public: |
|
270 static CCertToolRemoveApps* NewLC(CCertToolController* aController); |
|
271 static CCertToolRemoveApps* NewL(CCertToolController* aController); |
|
272 ~CCertToolRemoveApps(); |
|
273 |
|
274 public: // From CActive |
|
275 void RunL(); |
|
276 TInt RunError(TInt aError); |
|
277 |
|
278 protected: |
|
279 enum TState |
|
280 { |
|
281 EListCerts, |
|
282 ERetrieve, |
|
283 EGetApps, |
|
284 ERemoveApps, |
|
285 EFinished, |
|
286 EIntermediate |
|
287 } iState; |
|
288 |
|
289 private: |
|
290 CCertToolRemoveApps(CCertToolController* aController); |
|
291 |
|
292 }; |
|
293 |
|
294 #endif |