|
1 /* |
|
2 * Copyright (c) 2001-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 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 #ifndef __SECDLGIMPLDEFS_H__ |
|
28 #define __SECDLGIMPLDEFS_H__ |
|
29 |
|
30 #include <e32std.h> |
|
31 |
|
32 #include <secdlg.h> |
|
33 |
|
34 /** */ |
|
35 // KUidSecurityDialogNotifier is named KUidWIMDialogNotifier in the UID database |
|
36 const TUid KUidSecurityDialogNotifier = { 0x101F3CBB }; |
|
37 |
|
38 /** */ |
|
39 typedef TUint TSecurityDialogNotification; |
|
40 |
|
41 /** */ |
|
42 typedef TPckgBuf<TSecurityDialogNotification> TSecurityDialogNotificationBuf; |
|
43 |
|
44 |
|
45 /** |
|
46 * Defines the operations provided by the security dialog. |
|
47 * |
|
48 * It is used to identify the operation when transferring over to the notifier plugin. |
|
49 */ |
|
50 enum TSecurityDialogOperation |
|
51 { |
|
52 /** Secure connection */ |
|
53 ESecureConnection = 0x01, |
|
54 /** Sign text */ |
|
55 ESignText = 0x02, |
|
56 /** Enter PIN */ |
|
57 EEnterPIN = 0x04, |
|
58 /** Enable PIN */ |
|
59 EEnablePIN = 0x08, |
|
60 /** Disable PIN */ |
|
61 EDisablePIN = 0x10, |
|
62 /** Change PIN */ |
|
63 EChangePIN = 0x20, |
|
64 /** Unblock PIN */ |
|
65 EUnblockPIN = 0x40, |
|
66 /** PIN blocked */ |
|
67 EPINBlocked = 0x80, |
|
68 /** Total blocked */ |
|
69 ETotalBlocked = 0x100, |
|
70 /** Unblock PIN in clear */ |
|
71 EUnblockPINInClear = 0x200, |
|
72 /** ServerAuthenticationFailure */ |
|
73 EServerAuthenticationFailure = 0x400 |
|
74 }; |
|
75 |
|
76 /** */ |
|
77 const TInt KSecurityDialogOperationMask = 0xFFFF; |
|
78 const TInt KServerNameBuf = 0xFF; // 0xFF = 255 |
|
79 const TInt KEncodedCertBuf = 0x400; // 0x400 = 1024 |
|
80 |
|
81 /** Security dialog error condition */ |
|
82 enum TSecurityDialogErrorCondition |
|
83 { |
|
84 /** Incorrect PIN value */ |
|
85 EPINValueIncorrect = 0x10000000 |
|
86 }; |
|
87 |
|
88 /** */ |
|
89 //Passed back in TRequestStatus, if client agrees to authenticate/ The client TRequeststatus never gets set to this |
|
90 const TInt KClientAuthenticationRequested = 1; |
|
91 |
|
92 /** |
|
93 * Class used with corresponding TPckgBuf to build buffer for the |
|
94 * Server Authentication Failure Dialog operation. |
|
95 */ |
|
96 class TServerAuthenticationFailureInput |
|
97 { |
|
98 public: |
|
99 /** EServerAuthenticationFailure */ |
|
100 TSecurityDialogNotification iOperation; |
|
101 |
|
102 /** Server name */ |
|
103 TInt iServerNameLength; |
|
104 |
|
105 /** Encoded Certificate */ |
|
106 TInt iEncodedCertLength; |
|
107 |
|
108 /** Failure Reason */ |
|
109 TValidationError iFailureReason; |
|
110 }; |
|
111 |
|
112 /** */ |
|
113 typedef TPckgBuf<TServerAuthenticationFailureInput> TServerAuthenticationFailureInputBuf; |
|
114 |
|
115 /** |
|
116 * The input buffer for the secure connection and sign text operations. |
|
117 */ |
|
118 class TSignInput |
|
119 { |
|
120 public: |
|
121 /** */ |
|
122 TSecurityDialogNotification iOperation; |
|
123 |
|
124 /** */ |
|
125 TUint iVariableDataSize; |
|
126 |
|
127 /** */ |
|
128 TUint iCertHandleArrayTotal; |
|
129 |
|
130 /** |
|
131 * Whether to do client authentication |
|
132 * |
|
133 * Used only for secure connection dialog |
|
134 */ |
|
135 TBool iDoClientAuthentication; |
|
136 |
|
137 /** The connection type */ |
|
138 MSecurityDialog::TConnectionType iConnectionType; |
|
139 }; |
|
140 |
|
141 /** */ |
|
142 typedef TPckgBuf<TSignInput> TSignInputBuf; |
|
143 |
|
144 /** */ |
|
145 typedef TPckgBuf<TCTTokenObjectHandle> TCTTokenObjectHandleBuf; |
|
146 |
|
147 |
|
148 /** |
|
149 * Input data for the EEnterPIN, EChangePIN, EPINBlocked operations. |
|
150 */ |
|
151 class TPINInput |
|
152 { |
|
153 public: |
|
154 /** */ |
|
155 TSecurityDialogNotification iOperation; |
|
156 |
|
157 /** Information associated with the PIN */ |
|
158 TPINParams iPIN; |
|
159 }; |
|
160 |
|
161 /** */ |
|
162 typedef TPckgBuf<TPINInput> TPINInputBuf; |
|
163 |
|
164 |
|
165 |
|
166 /** |
|
167 * Input data for the EUnblockPIN operation. |
|
168 */ |
|
169 class TUnblockPINInput |
|
170 { |
|
171 public: |
|
172 TSecurityDialogNotification iOperation; |
|
173 TPINParams iPIN; |
|
174 TPINParams iUnblockPIN; |
|
175 }; |
|
176 |
|
177 /** */ |
|
178 typedef TPckgBuf<TUnblockPINInput> TUnblockPINInputBuf; |
|
179 |
|
180 /** |
|
181 * Output from the EServerAuthenticationFailure operations. |
|
182 */ |
|
183 /** Security dialog error condition */ |
|
184 enum TServerAuthenticationFailureDialogResult |
|
185 { |
|
186 EContinue = 0x01, |
|
187 EStop = 0x02 |
|
188 }; |
|
189 /** */ |
|
190 typedef TPckgBuf<TServerAuthenticationFailureDialogResult> TServerAuthenticationFailureOutputBuf; |
|
191 |
|
192 /** |
|
193 * Output from the EChangePIN and EUnblockPIN operations. |
|
194 */ |
|
195 class TTwoPINOutput |
|
196 { |
|
197 public: |
|
198 // This could be for the current PIN or the unblocking PIN |
|
199 TPINValue iPINValueToCheck; |
|
200 TPINValue iNewPINValue; |
|
201 }; |
|
202 |
|
203 /** */ |
|
204 typedef TPckgBuf<TTwoPINOutput> TTwoPINOutputBuf; |
|
205 |
|
206 /** */ |
|
207 typedef TPckgBuf<TPINValue> TPINValueBuf; |
|
208 |
|
209 |
|
210 |
|
211 /** |
|
212 * Output from the EUnblockPINInClear operation. |
|
213 */ |
|
214 class TUnblockPINInClearOutput |
|
215 { |
|
216 public: |
|
217 // This could be for the current PIN or the unblocking PIN |
|
218 TUnblockPINValue iPINValueToCheck; |
|
219 TPINValue iNewPINValue; |
|
220 }; |
|
221 |
|
222 /** */ |
|
223 typedef TPckgBuf<TUnblockPINInClearOutput> TUnblockPINInClearOutputBuf; |
|
224 |
|
225 |
|
226 /** |
|
227 * This class is used by the reference implementation of the security dialog, |
|
228 * CRefSecurityDialog, to pack the notifier buffer for the Server |
|
229 * Authentication Failure Dialog operation, and by the notifier server plugin |
|
230 * to unpack the buffer. |
|
231 */ |
|
232 |
|
233 class CServerAuthenticationFailureInput : public CBase |
|
234 { |
|
235 public: |
|
236 |
|
237 virtual ~CServerAuthenticationFailureInput(); |
|
238 |
|
239 /** |
|
240 * @internalComponent |
|
241 * |
|
242 * Static constructor function that uses the data passed in the call to |
|
243 * MSecurityDialog::ServerAuthenticationFailure to instantiate the object. |
|
244 * |
|
245 * Depending on the value of aCreateOwnBuffers, the object can allocate |
|
246 * new buffers with copies of the server name and encoded cert data, or it |
|
247 * can use pointers to the buffers for the existing descriptors. It should |
|
248 * only use the existing buffers if they won't be freed before an input |
|
249 * buffer for the notifier is created using PackBufferL. |
|
250 * |
|
251 * @param aServerName Name of the server with the certificate that |
|
252 * failed authentication. |
|
253 * @param aFailureReason Reason for certificate authentication failure. |
|
254 * @param aEncodedCert Encoded X509 Certificate data. |
|
255 * @param aCreateOwnBuffers Indicates whether new heap buffers are needed. |
|
256 * |
|
257 * @return The new CServerAuthenticationFailureInput |
|
258 * object. */ |
|
259 |
|
260 static CServerAuthenticationFailureInput* NewL(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse); |
|
261 /** @internalComponent */ |
|
262 static CServerAuthenticationFailureInput* NewLC(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse); |
|
263 |
|
264 /** |
|
265 * Static constructor function that constructs the object using the data |
|
266 * in a supplied buffer. This can be used in the implementation of a |
|
267 * plugin for the extended notifier framework; the buffer supplied to the |
|
268 * notifier for this dialog operation will be in the correct format to |
|
269 * construct the class with this function. |
|
270 * |
|
271 * Depending on the value of aCreateOwnBuffers, new buffers can be |
|
272 * allocated to hold copies of the server name and encoded cert data, or |
|
273 * the object can use pointers to the data positions within the input |
|
274 * buffer. It should only use the existing buffer if it will persist |
|
275 * until the data is no longer needed. |
|
276 * |
|
277 * @param aBuffer A data buffer containing the data needed |
|
278 * for the dialog. |
|
279 * @param aCreateOwnBuffers Indicates whether new heap buffers are |
|
280 * needed. |
|
281 * |
|
282 * @return The new CServerAuthenticationFailureInput |
|
283 * object. */ |
|
284 |
|
285 IMPORT_C static CServerAuthenticationFailureInput* NewL(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse); |
|
286 IMPORT_C static CServerAuthenticationFailureInput* NewLC(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse); |
|
287 |
|
288 |
|
289 /** |
|
290 * Gets the reason for validation failure. |
|
291 * |
|
292 * @return The failure reason. */ |
|
293 IMPORT_C TValidationError FailureReason(); |
|
294 |
|
295 /** |
|
296 * Sets the supplied TPtrC8 to point to the buffer for the server name. |
|
297 * |
|
298 * @param aServerNamePtr A reference to a TPtrC8 to set to point to |
|
299 * the server name data. */ |
|
300 IMPORT_C void GetServerName(TPtrC8& aServerNamePtr); |
|
301 |
|
302 /** |
|
303 * Sets the supplied TPtrC8 to point to the buffer for the encoded cert. |
|
304 * |
|
305 * @param aServerNamePtr A reference to a TPtrC8 to set to point to |
|
306 * the encoded cert data. */ |
|
307 IMPORT_C void GetEncodedCert(TPtrC8& aEncodedCertPtr); |
|
308 |
|
309 /** |
|
310 * @internalComponent |
|
311 * |
|
312 * Allocates and fills a heap buffer with the data to be sent to the |
|
313 * notifier server. Ownership of this buffer passes to the calling |
|
314 * method. |
|
315 * |
|
316 * @return The allocated buffer. */ |
|
317 |
|
318 HBufC8* PackBufferL() const; |
|
319 |
|
320 private: |
|
321 CServerAuthenticationFailureInput(); |
|
322 |
|
323 void ConstructL(const TDesC8& aServerName,const TValidationError& aFailureReason, const TDesC8& aEncodedCert, const TBool aCreateOwnBuffers = EFalse); |
|
324 void ConstructL(const TDesC8& aBuffer, const TBool aCreateOwnBuffers = EFalse); |
|
325 |
|
326 private: |
|
327 /** EServerAuthenticationFailure */ |
|
328 TSecurityDialogNotification iOperation; |
|
329 |
|
330 /** Failure Reason */ |
|
331 TValidationError iFailureReason; |
|
332 |
|
333 /** Server name */ |
|
334 HBufC8* iServerName; |
|
335 TPtrC8 iServerNamePtr; |
|
336 |
|
337 /** Encoded Certificate */ |
|
338 HBufC8* iEncodedCert; |
|
339 TPtrC8 iEncodedCertPtr; |
|
340 |
|
341 }; |
|
342 |
|
343 #endif |