|
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: Interface for PKI dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPKIDIALOG_H |
|
20 #define MPKIDIALOG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <ct.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * PKI Dialog interface |
|
32 * |
|
33 * @since Series60 3,0 |
|
34 */ |
|
35 class MPKIDialog |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * TNoteType defines different possible note types. |
|
41 */ |
|
42 enum TNoteType |
|
43 { |
|
44 ESignatureRequested = 0xFF00, // Digital signature requested |
|
45 ESignatureDone, // Digital signature done. |
|
46 ESigningCancelled, // Digital signing cancelled |
|
47 ENoMatchCert, // No matchig certificate found |
|
48 ENoSecurityModule, // Security Module unvailable |
|
49 EInternalError // Error note in any other case |
|
50 }; |
|
51 public: // New functions |
|
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 virtual void UserAuthentication( |
|
64 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
65 TCTTokenObjectHandle& aCertHandle, |
|
66 TRequestStatus& aStatus ) = 0; |
|
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 virtual void UserAuthenticationText( |
|
81 const TDesC& aTextToSign, |
|
82 const RArray<TCTTokenObjectHandle>& aCertHandleList, |
|
83 TCTTokenObjectHandle& aCertHandle, |
|
84 TRequestStatus& aStatus ) = 0; |
|
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 virtual void CreateCSR( |
|
95 const TDesC& aSubject, |
|
96 const TCTTokenObjectHandle& aKeyHandle, |
|
97 TRequestStatus& aStatus ) = 0; |
|
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 virtual void CertificateDetails( |
|
109 const TCTTokenObjectHandle& aCertHandle, |
|
110 TRequestStatus& aStatus ) = 0; |
|
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 virtual void SaveCertificate( |
|
121 TCertificateFormat aFormat, |
|
122 TCertificateOwnerType aCertificateOwnerType, |
|
123 const TDesC8& aCert, TRequestStatus& aStatus) = 0; |
|
124 |
|
125 /** |
|
126 * Asks user's approval for certificate deleting. |
|
127 * @param aCertHandle An identifier of the certificate |
|
128 * @param aStatus KErrNone, KErrCancel or KErrNotSupported, |
|
129 * KErrNotFound if no certificates could |
|
130 * be presented to the user. |
|
131 * @return void |
|
132 */ |
|
133 virtual void DeleteCertificate( |
|
134 const TCTTokenObjectHandle& aCertHandle, |
|
135 TRequestStatus& aStatus ) = 0; |
|
136 |
|
137 /** |
|
138 * Informs the user during digital signing. |
|
139 * @param aNoteType Identifies the note type. |
|
140 * @param aStatus KErrNone or KErrNotSupported |
|
141 * @return void |
|
142 */ |
|
143 virtual void Note( MPKIDialog::TNoteType aNoteType, |
|
144 TRequestStatus& aStatus ) = 0; |
|
145 |
|
146 /** |
|
147 * Saves receipt to Notepad if receipt saving is on. |
|
148 * @param aSignedText Signed text in readable form. |
|
149 * @param aStatus KErrNone or KErrNotSupported |
|
150 * @return void |
|
151 */ |
|
152 virtual void SaveSignedText( const TDesC& aSignedText, |
|
153 TRequestStatus& aStatus ) = 0; |
|
154 |
|
155 /** |
|
156 * Shows instructions how to unblock PIN. |
|
157 * @param aLabel Label of the PIN. |
|
158 * @param aStatus KErrNone or KErrNotSupported |
|
159 * @return void |
|
160 */ |
|
161 virtual void PINBlockedInfo( const TPINLabel& aLabel, |
|
162 TRequestStatus& aStatus ) = 0; |
|
163 /** |
|
164 * Release is called to free resources of the MDigSigningNote class |
|
165 */ |
|
166 virtual void Release() = 0; |
|
167 |
|
168 protected: |
|
169 |
|
170 // Destructor |
|
171 inline virtual ~MPKIDialog() = 0; |
|
172 |
|
173 }; |
|
174 |
|
175 inline MPKIDialog::~MPKIDialog(){} |
|
176 |
|
177 /** |
|
178 * Factory for creating the relevant concrete subclass |
|
179 * of the PKI Dialog. |
|
180 */ |
|
181 class PKIDialogFactory |
|
182 { |
|
183 public: |
|
184 |
|
185 /** |
|
186 * Creates an instance of a subclass of MPKIDialog. |
|
187 * Implement to create the appropriate security dialog. |
|
188 * |
|
189 * @param returns an object that implements MPKIDialog methods |
|
190 */ |
|
191 IMPORT_C static MPKIDialog* CreateNoteL(); |
|
192 |
|
193 }; |
|
194 |
|
195 #endif // MPKIDIALOG_H |
|
196 |
|
197 // End of File |