|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Pritam Roy Biswas, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Description: |
|
13 * This is the private implementation Class on Symbian OS for Credential Manager Client. |
|
14 * Derives from CAtive to support asynchronous requests. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __SMFCREDMGRCLIENT_P_H__ |
|
19 #define __SMFCREDMGRCLIENT_P_H__ |
|
20 |
|
21 // Include Files |
|
22 #ifdef Q_OS_SYMBIAN |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <e32cmn.h> |
|
26 #include <s32strm.h> |
|
27 #include <S32MEM.H> |
|
28 #include <e32des16.h> |
|
29 #endif |
|
30 #include <QUrl> |
|
31 #include <QDateTime> |
|
32 #include <private/qcore_symbian_p.h> |
|
33 #include <QtCore/qglobal.h> |
|
34 #include <qstring.h> |
|
35 #include <QStringList> |
|
36 #include <qbytearray.h> |
|
37 #include <qlist.h> |
|
38 |
|
39 #ifdef Q_OS_SYMBIAN |
|
40 #include "smfcredmgrcommon.h" //client-server common header. |
|
41 #include "smfcredmgrclientsession.h" |
|
42 #include "smfcredmgrclientglobal.h" |
|
43 #else |
|
44 #endif |
|
45 |
|
46 const TInt KMinBufSize = 128; |
|
47 const TInt KMaxBufSize = 512; |
|
48 |
|
49 //forward declarations |
|
50 class SmfCredMgrClient; |
|
51 |
|
52 /** |
|
53 * The private implementation class for the APIs exported by Credential Manager. |
|
54 * Its a symbian implementation. |
|
55 */ |
|
56 class CSmfCredMgrClientSymbian : public CActive |
|
57 { |
|
58 public: |
|
59 /** |
|
60 * new methods |
|
61 * @param aPublicImpl The Qt client object |
|
62 */ |
|
63 static CSmfCredMgrClientSymbian* NewL(SmfCredMgrClient* aPublicImpl); |
|
64 static CSmfCredMgrClientSymbian* NewLC(SmfCredMgrClient* aPublicImpl); |
|
65 |
|
66 /** |
|
67 * Destructor |
|
68 */ |
|
69 ~CSmfCredMgrClientSymbian(); |
|
70 |
|
71 /** |
|
72 * Method to store all data related to an auth app i.e URL list for Plugins, List of Plugins.etc. |
|
73 * Called by storeAuthData() of SmfCredMgrClient. |
|
74 * @param Set The auth Key set |
|
75 * @param Validity time by which the Auth set will expire |
|
76 * @param URLList The URL list to be set |
|
77 * @param PluginList The plugin list to be set |
|
78 * @param AuthAppAID The Authentication Application Id |
|
79 * @param Flag flag to enable or disable the plugin |
|
80 * @return The registration token that completes authentication |
|
81 */ |
|
82 QString storeAuthDataL(SmfAuthParams Set, QDateTime Validity, |
|
83 QList<QUrl> URLList, QStringList PluginList, QString AuthAppAID, |
|
84 bool Flag); |
|
85 |
|
86 /** |
|
87 * Method to check the authentication of a Plugin |
|
88 * @param PluginID Id of the Plugin to be checked. |
|
89 * @return True if authenticated or False if not |
|
90 */ |
|
91 TBool isPluginAuthenticatedL(QString PluginID); |
|
92 |
|
93 /** |
|
94 * Method to get the list of authenticated plugins |
|
95 * @param RegistrationToken The token that validates a list of such plugins. |
|
96 * @param List The list of authenticated plugins to be retrieved |
|
97 */ |
|
98 void authenticatedPluginListL(QString RegistrationToken, QStringList& List); |
|
99 |
|
100 /** |
|
101 * Method to get list of URLs which plugin can access |
|
102 * @param PluginID The ID of the Plugin whose corresponding list of URLs to be retrieved |
|
103 * @param List The URL list to be retrieved |
|
104 */ |
|
105 void URLListL(QString PluginID, QList<QUrl>& List); |
|
106 |
|
107 /** |
|
108 * Method to generate NONCE token |
|
109 * @param Length Lenth of the NONCE tobe generated |
|
110 * @return The generated NONCE |
|
111 */ |
|
112 QString generateNONCE(const qint64 Length); |
|
113 |
|
114 /** |
|
115 * Method to update the list of authenticated plugins-add, remove, update to plugins |
|
116 * Called by changePluginIDList() of SmfCredMgrClient. |
|
117 * @param NewPluginID ID of the new plugin |
|
118 * @param Flag boolean to indicate plugin is enabled or disabled |
|
119 * @param OldPluginID ID of the old plugin to be replaced |
|
120 */ |
|
121 void changePluginIDListL(const QString NewPluginID, const bool Flag, |
|
122 const QString OldPluginID); |
|
123 |
|
124 /** |
|
125 * Method to get the Auth Token set, eg:OAuth_RequestToken; OAuth_AccessToken |
|
126 * @param RegToken Registration Token previously obtained from SMF |
|
127 * @param Validity time by which the Auth set will expire, its to check if reg token is still valid |
|
128 * @param AuthTokenSet the Auth Token Set for the plugin |
|
129 * @return boolean value if the reg token is still valid |
|
130 */ |
|
131 TBool AuthDataSetL(QString RegToken, QDateTime Validity, |
|
132 SmfAuthParams& AuthTokenSet); |
|
133 |
|
134 /** |
|
135 * Method to store RSA Keys |
|
136 * @param KeyLabel First key of the key pair |
|
137 * @param keydata Other key of the key pair |
|
138 * @param Validity time by which the key set will expire |
|
139 * @return The Label of key pair |
|
140 */ |
|
141 QString storeRSAKeysL(const QString KeyLabel, const QString keydata, |
|
142 const QDateTime Validity); |
|
143 /** |
|
144 * API to Sign the message |
|
145 * @param Message The message to be signed |
|
146 * @param Key If Signature method is RSA-SHA1 then it must be equal to the value |
|
147 * returned while storeRSAKeys(), if signature method is HMAC-SHA1 key |
|
148 * must the value to sign the message with |
|
149 * @param Signature The signed message is an output argument |
|
150 * @param AlgorithmUsed The algorithm used for signing |
|
151 * return Smf defined errorcode |
|
152 * @todo - RSA Signing is falgged-put for time being. |
|
153 */ |
|
154 SMFCredMgrErrorCode signMessageL(QString Message, QString Key, |
|
155 QString& Signature, SmfSignatureMethod AlgorithmUsed); |
|
156 /** |
|
157 * API To delete the RSA Key from the Key Store |
|
158 * @param KeyLabel The Label of key pair. This is the value returned while StoreRSAKeys(). |
|
159 */ |
|
160 void deleteRSAKey(QString KeyLabel); |
|
161 |
|
162 protected: |
|
163 // Functions from base classes |
|
164 |
|
165 /** |
|
166 * From CActive, RunL. |
|
167 * Callback function. |
|
168 * Invoked to handle responses from the server. |
|
169 */ |
|
170 void RunL(); |
|
171 |
|
172 /** |
|
173 * From CActive, DoCancel. |
|
174 * Cancels any outstanding operation. |
|
175 */ |
|
176 void DoCancel(); |
|
177 |
|
178 private: |
|
179 /** |
|
180 * Constructor |
|
181 * @param aObserver symbianClientObserver object to notify the Qt-Client |
|
182 */ |
|
183 CSmfCredMgrClientSymbian(SmfCredMgrClient* aPublicImpl); |
|
184 |
|
185 /** |
|
186 * Symbian two phase constructor |
|
187 */ |
|
188 void ConstructL(); |
|
189 |
|
190 private: |
|
191 /** |
|
192 *Handle to the session |
|
193 */ |
|
194 RSmfCredMgrClientSession iSession; |
|
195 /** |
|
196 * Wrapper class object. |
|
197 */ |
|
198 SmfCredMgrClient* iPublicImpl; |
|
199 |
|
200 }; |
|
201 |
|
202 #endif // __SMFCREDMGRCLIENT_P_H__ |