|
1 /* |
|
2 * Copyright (c) 2005 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: Header file of the CPKIDialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPKIDLG_H |
|
20 #define CPKIDLG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "SecurityDialogBase.h" |
|
24 #include <PKIDlg.h> // MPKIDialog |
|
25 #include <e32std.h> |
|
26 #include <secdlgimpldefs.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCTSecurityDialogRequestor; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * This class implements MPKIDialog interface. |
|
35 * |
|
36 * |
|
37 * @lib CTSecDlgs.lib |
|
38 * @since Series60_3:0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CPKIDialog ): |
|
41 public CBase, public MSecurityDialogResponse, public MPKIDialog |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 static CPKIDialog* NewL(); |
|
49 |
|
50 |
|
51 public: // Functions from MPKIDialog |
|
52 |
|
53 /** |
|
54 * User authentication dialogs |
|
55 * @param aCertHandleList A selection of certificates to display to the user. |
|
56 * All certificates are displayed if this is empty. |
|
57 * @param aCertHandle On return, an identifier for the certificate the user selected. |
|
58 * aStatus - this will be set to KErrNotFound if no certificates |
|
59 * could be presented to the user. |
|
60 * @param aStatus This will be set to KErrNotFound if no certificates could |
|
61 * be presented to the user. |
|
62 */ |
|
63 void UserAuthentication( |
|
64 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
65 TCTTokenObjectHandle& aCertHandle, |
|
66 TRequestStatus& aStatus ); |
|
67 |
|
68 /** |
|
69 * User authentication dialogs with text |
|
70 * |
|
71 * @param aTextToSign The text to be signed. |
|
72 * @param aCertHandleList A selection of certificates to display to the user. |
|
73 * All certificates are displayed if this is empty. |
|
74 * @param aCertHandle On return, an identifier for the certificate the user selected. |
|
75 * aStatus - this will be set to KErrNotFound if no certificates |
|
76 * could be presented to the user. |
|
77 * @param aStatus This will be set to KErrNotFound if no certificates could |
|
78 * be presented to the user. |
|
79 */ |
|
80 void UserAuthenticationText( |
|
81 const TDesC& aTextToSign, |
|
82 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
83 TCTTokenObjectHandle& aCertHandle, |
|
84 TRequestStatus& aStatus ); |
|
85 |
|
86 /** |
|
87 * Certificate signing request dialog |
|
88 * |
|
89 * @param aSubject Subject of the certificate |
|
90 * @param aKeyHandle An identifier of the private used in the CSR. |
|
91 * @param aStatus This will be set to KErrNotFound if no certificates could |
|
92 * be presented to the user. |
|
93 */ |
|
94 void CreateCSR( |
|
95 const TDesC& aSubject, |
|
96 const TCTTokenObjectHandle& aKeyHandle, |
|
97 TRequestStatus& aStatus ); |
|
98 |
|
99 |
|
100 /** |
|
101 * Shows details of the certificate |
|
102 * @param aCertHandle An identifier of the certificate |
|
103 * @param aStatus KErrNone or KErrNotSupported |
|
104 * KErrNotFound if no certificates could |
|
105 * be presented to the user. |
|
106 * @return void |
|
107 */ |
|
108 void CertificateDetails( |
|
109 const TCTTokenObjectHandle& aCertHandle, |
|
110 TRequestStatus& aStatus ); |
|
111 /** |
|
112 * Asks user's approval for certificate saving. |
|
113 * @param aFormat The format of the certificate. |
|
114 * @param aCertificateOwnerType The owner type. |
|
115 * @param aCert The certificate to be added. |
|
116 * @param aStatus KErrNone, KErrCancel or KErrNotSupported, |
|
117 * KErrArgument if error in certificate parsing |
|
118 * @return void |
|
119 */ |
|
120 void SaveCertificate( |
|
121 TCertificateFormat aFormat, |
|
122 TCertificateOwnerType aCertificateOwnerType, |
|
123 const TDesC8& aCert, |
|
124 TRequestStatus& aStatus); |
|
125 |
|
126 /** |
|
127 * Asks user's approval for certificate deleting. |
|
128 * @param aCertHandle An identifier of the certificate |
|
129 * @param aStatus KErrNone, KErrCancel or KErrNotSupported, |
|
130 * KErrNotFound if no certificates could |
|
131 * be presented to the user. |
|
132 * @return void |
|
133 */ |
|
134 void DeleteCertificate( |
|
135 const TCTTokenObjectHandle& aCertHandle, |
|
136 TRequestStatus& aStatus ); |
|
137 |
|
138 /** |
|
139 * Informs the user during digital signing. |
|
140 * @param aNoteType Identifies the note type. |
|
141 * @param aStatus KErrNone or KErrNotSupported |
|
142 * @return void |
|
143 */ |
|
144 void Note( MPKIDialog::TNoteType aNoteType, |
|
145 TRequestStatus& aStatus ); |
|
146 |
|
147 /** |
|
148 * Saves receipt to Notepad if receipt saving is on. |
|
149 * @param aSignedText Signed text in readable form. |
|
150 * @param aStatus KErrNone or KErrNotSupported |
|
151 * @return void |
|
152 */ |
|
153 void SaveSignedText( const TDesC& aSignedText, |
|
154 TRequestStatus& aStatus ); |
|
155 |
|
156 /** |
|
157 * Shows instructions how to unblock PIN. |
|
158 * @param aLabel Label of the PIN. |
|
159 * @param aStatus KErrNone or KErrNotSupported |
|
160 * @return void |
|
161 */ |
|
162 void PINBlockedInfo( const TPINLabel& aLabel, |
|
163 TRequestStatus& aStatus ); |
|
164 /** |
|
165 * Release is called to free resources of the MDigSigningNote class |
|
166 */ |
|
167 void Release(); |
|
168 |
|
169 public: // Functions from MSecurityDialogResponse |
|
170 |
|
171 void HandleResponse(TInt aResult); |
|
172 |
|
173 |
|
174 private: |
|
175 |
|
176 /** |
|
177 * C++ default constructor. |
|
178 */ |
|
179 CPKIDialog(); |
|
180 |
|
181 /** |
|
182 * Destructor. |
|
183 */ |
|
184 ~CPKIDialog(); |
|
185 |
|
186 /** |
|
187 * By default Symbian 2nd phase constructor is private. |
|
188 */ |
|
189 void ConstructL(); |
|
190 |
|
191 /** |
|
192 * |
|
193 * @param aStatus |
|
194 */ |
|
195 void InitClientStatus(TRequestStatus& aStatus); |
|
196 |
|
197 /** |
|
198 * ShowNoteL shows a dialog/note using Notifier API. |
|
199 * |
|
200 * @param aStatus Signaled value for async operation. KErrNone if successful, otherwise system error. |
|
201 * @param aDlgType Dialog type |
|
202 * @param aReturnValue Return value of a dialog. If aStatus == KErrNone, then the user's response |
|
203 * is located here. ETrue means positive response (OK, continue etc.), |
|
204 * EFalse means negative response. |
|
205 * @param aDynamic Dynamic text for dialog. Effective only if %U is in the localisation resource. |
|
206 * |
|
207 * Leaves on: System error before showing the actual dialog |
|
208 * |
|
209 * Asserts on: If aDlgType is a PIN/PUK code query. |
|
210 */ |
|
211 void ShowNoteL(TRequestStatus& aStatus, |
|
212 TInt aNoteTypeaDlgType, |
|
213 const TDesC& aDynamic = KNullDesC); |
|
214 |
|
215 void RequestWithTokenHandleL( |
|
216 const TDesC& aText, |
|
217 const TCTTokenObjectHandle& aTokenHandle, |
|
218 TRequestStatus& aStatus ); |
|
219 |
|
220 void DoSaveCertificateL( |
|
221 TCertificateFormat aFormat, |
|
222 TCertificateOwnerType aCertificateOwnerType, |
|
223 const TDesC8& aCert, |
|
224 TRequestStatus& aStatus); |
|
225 |
|
226 private: // Data |
|
227 CCTSecurityDialogRequestor* iRequester; // Owned |
|
228 TRequestStatus* iClientStatus; // Pointer to client's request status |
|
229 // We must signal it when dialogrequestor |
|
230 // RunL is called to signal the completion of a dialog! |
|
231 |
|
232 CBufFlat* iSenderBuffer; // Stream buffer for outgoing streams. |
|
233 HBufC8* iBufferData; // iSenderBuffer help buffer |
|
234 |
|
235 TDialogType iCurrentOperation; |
|
236 |
|
237 TSignInputBuf iSignInputBuf; |
|
238 TPtrC8 iVariableDataPtr; |
|
239 TCTTokenObjectHandle* iClientCertInfoHandlePtr; |
|
240 TCTTokenObjectHandleBuf iCertInfoHandleBuf; |
|
241 TBuf8<10> iDlgResponseBuf; |
|
242 }; |
|
243 |
|
244 #endif // CPKIDLG_H |
|
245 |
|
246 // End of File |