|
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 header file gives different data classes to be used |
|
14 * by Credential Manager Client and Server for data transfer. |
|
15 * |
|
16 */ |
|
17 #ifndef CSMFCREDMGRCLIENTDATASTRUCT_H_ |
|
18 #define CSMFCREDMGRCLIENTDATASTRUCT_H_ |
|
19 |
|
20 // System includes |
|
21 #include <e32cmn.h> |
|
22 #include <S32MEM.H> |
|
23 #include <s32strm.h> |
|
24 |
|
25 #include "smfcredmgrcommon.h" |
|
26 |
|
27 /** |
|
28 * Maximum Length for AuthTokens |
|
29 */ |
|
30 const TInt KMaxAuthTokenLength = 256; |
|
31 |
|
32 /** |
|
33 * Maximum Length for Plugin ID |
|
34 */ |
|
35 const TInt KMaxPluginIDLength = 256; |
|
36 |
|
37 /** |
|
38 * Maximum Length for Registration Token |
|
39 */ |
|
40 const TInt KMaxRegistrationTokenLength = 50; |
|
41 |
|
42 /** |
|
43 * Maximum Length for URLString |
|
44 */ |
|
45 const TInt KMaxURLStringLength = 256; |
|
46 |
|
47 /** |
|
48 * Maximum Length for Authentication Application ID |
|
49 */ |
|
50 const TInt KMaxAuthIdLength = 256; |
|
51 |
|
52 /** |
|
53 * Maximum Length for SignedMessage |
|
54 */ |
|
55 const TInt KMaxSignedMsgLength = 256; |
|
56 /** |
|
57 * This class provide details and to serialize Authentication Key And Secret |
|
58 */ |
|
59 class TSmfAuthToken |
|
60 { |
|
61 public: |
|
62 /** |
|
63 * constructor |
|
64 */ |
|
65 inline TSmfAuthToken() : |
|
66 iKey(NULL), iSecret(NULL) |
|
67 { |
|
68 } |
|
69 /** |
|
70 * Method to externalize the member variables |
|
71 * @param aStream The Write Stream to be filled. |
|
72 */ |
|
73 void ExternalizeL(RWriteStream& aStream); |
|
74 |
|
75 /** |
|
76 * Method to internalize the member variables |
|
77 * @param aStream the stream to read from |
|
78 */ |
|
79 void InternalizeL(RReadStream& aStream); |
|
80 |
|
81 /** |
|
82 * buf to hold the key |
|
83 */ |
|
84 HBufC* iKey; |
|
85 /** |
|
86 * buf to hold the secret |
|
87 */ |
|
88 HBufC* iSecret; |
|
89 }; |
|
90 |
|
91 /** |
|
92 * This class provide details and to serialize for the API fetching Authentication Parameters |
|
93 */ |
|
94 class CSmfFetchAuthTokenSet : public CBase |
|
95 { |
|
96 public: |
|
97 /** |
|
98 * destructor |
|
99 */ |
|
100 ~CSmfFetchAuthTokenSet() |
|
101 { |
|
102 iAuthTokenArray.Reset(); |
|
103 delete iRegistrationToken; |
|
104 } |
|
105 |
|
106 /** |
|
107 * Method to externalize the member variables |
|
108 * @param aStream The Write Stream to be filled. |
|
109 */ |
|
110 void ExternalizeL(RWriteStream& aStream); |
|
111 |
|
112 /** |
|
113 * Method to internalize the member variables |
|
114 * @param aSource the source to read from |
|
115 */ |
|
116 void InternalizeL(const RBuf8& aSource); |
|
117 /** |
|
118 * buf to hold registration token |
|
119 */ |
|
120 HBufC* iRegistrationToken; |
|
121 /** |
|
122 * Time by which the Auth set will expire |
|
123 */ |
|
124 TUint32 iValidity; |
|
125 /** |
|
126 * array in symbian to hold the key-value pair |
|
127 */ |
|
128 RArray<TSmfAuthToken> iAuthTokenArray; |
|
129 }; |
|
130 |
|
131 /** |
|
132 * This class provide details and to serialize of data to the API retreiving URL List |
|
133 */ |
|
134 class CSmfURLListParams : public CBase |
|
135 { |
|
136 public: |
|
137 /** |
|
138 * destructor |
|
139 */ |
|
140 ~CSmfURLListParams() |
|
141 { |
|
142 iURLList.ResetAndDestroy(); |
|
143 delete iPluginID; |
|
144 } |
|
145 |
|
146 /** |
|
147 * Method to externalize the member variables |
|
148 * @param aStream The Write Stream to be filled. |
|
149 */ |
|
150 void ExternalizeL(RWriteStream& aStream); |
|
151 |
|
152 /** |
|
153 * Method to internalize the member variables |
|
154 * @param aSource the source to read from |
|
155 */ |
|
156 void InternalizeL(const TDesC8& aSource); |
|
157 |
|
158 /** |
|
159 * array in symbian to hold url list |
|
160 */ |
|
161 RPointerArray<HBufC> iURLList; |
|
162 |
|
163 /** |
|
164 * buf to hold the plugin id for which urls will be queried |
|
165 */ |
|
166 HBufC* iPluginID; |
|
167 }; |
|
168 |
|
169 /** |
|
170 * This class provide details and to serialize data to the API retreiving Authenticated PluginID List |
|
171 */ |
|
172 class CSmfPluginIDListParams : public CBase |
|
173 { |
|
174 public: |
|
175 /** |
|
176 * destructor |
|
177 */ |
|
178 ~CSmfPluginIDListParams() |
|
179 { |
|
180 iPluginList.ResetAndDestroy(); |
|
181 delete iRegistrationToken; |
|
182 } |
|
183 |
|
184 /** |
|
185 * Method to externalize the member variables |
|
186 * @param aStream The Write Stream to be filled. |
|
187 */ |
|
188 void ExternalizeL(RWriteStream& aStream); |
|
189 |
|
190 /** |
|
191 * Method to internalize the member variables |
|
192 * @param aSource the source to read from |
|
193 */ |
|
194 void InternalizeL(const RBuf8& aSource); |
|
195 /** |
|
196 * array in symbian to hold plugin list |
|
197 */ |
|
198 RPointerArray<HBufC> iPluginList; |
|
199 /** |
|
200 * buf to hold registration token for which the list of plugins will be queried |
|
201 */ |
|
202 HBufC* iRegistrationToken; |
|
203 }; |
|
204 |
|
205 /** |
|
206 * Class to provide details of data to API storing Parameters during Authentication process |
|
207 */ |
|
208 class CSmfStoreAuthParams : public CBase |
|
209 { |
|
210 public: |
|
211 /** |
|
212 * destructor |
|
213 */ |
|
214 ~CSmfStoreAuthParams() |
|
215 { |
|
216 iAuthTokenArray.Reset(); |
|
217 iURLList.ResetAndDestroy(); |
|
218 iPluginIDList.ResetAndDestroy(); |
|
219 delete iRegistrationToken; |
|
220 delete iAuthAppID; |
|
221 } |
|
222 |
|
223 /** |
|
224 * Method to externalize the member variables |
|
225 * @param aStream The Write Stream to be filled. |
|
226 */ |
|
227 void ExternalizeL(RWriteStream& aStream); |
|
228 |
|
229 /** |
|
230 * Method to internalize the member variables |
|
231 * @param aSource the source to read from |
|
232 */ |
|
233 void InternalizeL(const RBuf8& aSource); |
|
234 /** |
|
235 * array to hold TSmfAuthToken elements |
|
236 */ |
|
237 RArray<TSmfAuthToken> iAuthTokenArray; |
|
238 /** |
|
239 * array to hold list of plugins |
|
240 */ |
|
241 RPointerArray<HBufC> iPluginIDList; |
|
242 /** |
|
243 * array to hold URl list |
|
244 */ |
|
245 RPointerArray<HBufC> iURLList; |
|
246 /** |
|
247 * buf to hold the registration token |
|
248 */ |
|
249 HBufC* iRegistrationToken; |
|
250 /** |
|
251 * buf to hold the authentication application ID |
|
252 */ |
|
253 HBufC* iAuthAppID; |
|
254 /** |
|
255 * flag to indicate an enabled pluginID |
|
256 */ |
|
257 TBool pluginIDEnabled; |
|
258 /** |
|
259 * Time by which the Auth set will expire |
|
260 */ |
|
261 TUint32 iValidity; |
|
262 }; |
|
263 |
|
264 /** |
|
265 * Class to provide details of data to the API changing/updating Authenticated |
|
266 * plugin list |
|
267 */ |
|
268 class CSmfPluginIDUpdate : public CBase |
|
269 { |
|
270 public: |
|
271 ~CSmfPluginIDUpdate() |
|
272 { |
|
273 delete iNewPluginID; |
|
274 delete iOldPluginID; |
|
275 } |
|
276 |
|
277 /** |
|
278 * Method to externalize the member variables |
|
279 * @param aStream The Write Stream to be filled. |
|
280 */ |
|
281 void ExternalizeL(RWriteStream& aStream); |
|
282 |
|
283 /** |
|
284 * Method to internalize the member variables |
|
285 * @param aSource the source to read from |
|
286 */ |
|
287 void InternalizeL(const RBuf8& aSource); |
|
288 |
|
289 /** |
|
290 * Id of new plugin |
|
291 */ |
|
292 HBufC* iNewPluginID; |
|
293 /** |
|
294 * Id of the old plugin to be replaced |
|
295 */ |
|
296 HBufC* iOldPluginID; |
|
297 /** |
|
298 * flag to indicate an enabled pluginID |
|
299 */ |
|
300 TBool pluginIDEnabled; |
|
301 }; |
|
302 |
|
303 /** |
|
304 * Class to provide data to Signing API. |
|
305 */ |
|
306 class CSmfSignParameters : public CBase |
|
307 { |
|
308 public: |
|
309 /** |
|
310 * New Functions |
|
311 */ |
|
312 static CSmfSignParameters* NewL( const TDesC8& aMessage, const TDesC8& aKey ); |
|
313 static CSmfSignParameters* NewL( const TDesC8& aData ); |
|
314 /** |
|
315 * Destructor |
|
316 */ |
|
317 ~CSmfSignParameters(); |
|
318 /** |
|
319 * Method to externalize the member variables |
|
320 * @param aStream The Write Stream to be filled. |
|
321 */ |
|
322 void ExternalizeL( RWriteStream& aStream ) const; |
|
323 /** |
|
324 * Get Method for key. |
|
325 */ |
|
326 const TDesC8& Key() const; |
|
327 /** |
|
328 * Get Method for message. |
|
329 */ |
|
330 const TDesC8& Message() const; |
|
331 |
|
332 private: |
|
333 /** |
|
334 * Constructor |
|
335 */ |
|
336 CSmfSignParameters(); |
|
337 /** |
|
338 * Two Phase constructors |
|
339 */ |
|
340 void ConstructL( const TDesC8& aMessage, const TDesC8& aKey ); |
|
341 void ConstructL( const TDesC8& aData ); |
|
342 |
|
343 private: |
|
344 /** |
|
345 * Message to sign |
|
346 */ |
|
347 RBuf8 iMessage; |
|
348 /** |
|
349 * Key for the signature |
|
350 */ |
|
351 RBuf8 iKey; |
|
352 }; |
|
353 |
|
354 /** |
|
355 * Class to provide RSA key details |
|
356 */ |
|
357 class CSmfRsaKeyParameters : public CBase |
|
358 { |
|
359 public: |
|
360 /** |
|
361 * New methods |
|
362 */ |
|
363 static CSmfRsaKeyParameters* NewL( |
|
364 const TDesC& aKeyName, const TTime& startDate, |
|
365 const TTime& endDate, const TDesC8& aKeyData ); |
|
366 static CSmfRsaKeyParameters* NewL( const TDesC8& aData ); |
|
367 |
|
368 /** |
|
369 * Destructor |
|
370 */ |
|
371 ~CSmfRsaKeyParameters(); |
|
372 /** |
|
373 * Method to externalize the member variables |
|
374 * @param aStream The Write Stream to be filled. |
|
375 */ |
|
376 void ExternalizeL( RWriteStream& aStream ) const; |
|
377 /** |
|
378 * Get Method for keyname. |
|
379 */ |
|
380 const TDesC& KeyName() const; |
|
381 /** |
|
382 * Get Method for keydata. |
|
383 */ |
|
384 const TDesC8& KeyData() const; |
|
385 /** |
|
386 * Get Method for start date. |
|
387 */ |
|
388 const TTime& StartDate() const; |
|
389 /** |
|
390 * Get Method for end date. |
|
391 */ |
|
392 const TTime& EndDate() const; |
|
393 |
|
394 private: |
|
395 /** |
|
396 * Two phase constructors |
|
397 */ |
|
398 void ConstructL( |
|
399 const TDesC& aKeyName, const TTime& startDate, |
|
400 const TTime& endDate, const TDesC8& aKeyData ); |
|
401 void ConstructL( const TDesC8& aData ); |
|
402 |
|
403 private: |
|
404 /** |
|
405 * Name of the key pair |
|
406 */ |
|
407 RBuf iKeyName; |
|
408 /** |
|
409 * Data of the key pair |
|
410 */ |
|
411 RBuf8 iKeyData; |
|
412 /** |
|
413 * Start date of validity |
|
414 */ |
|
415 TTime iStartDate; |
|
416 /** |
|
417 * End date of validity |
|
418 */ |
|
419 TTime iEndDate; |
|
420 }; |
|
421 |
|
422 #endif /* CSMFCREDMGRCLIENTDATASTRUCT_H_ */ |