|
1 /* |
|
2 * Copyright (c) 2006-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 * plugin characteristic definition |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedAll |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __CRYPTOAPI_PLUGINCHARACTERISTICS_H__ |
|
27 #define __CRYPTOAPI_PLUGINCHARACTERISTICS_H__ |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <cryptospi/cryptoparams.h> |
|
31 #include <s32mem.h> |
|
32 |
|
33 // Forward declarations |
|
34 struct TRomLitC16; |
|
35 |
|
36 |
|
37 namespace CryptoSpi |
|
38 { |
|
39 const TInt32 KInterfaceType = 0x10283527; |
|
40 const TInt32 KAlgorithmType = 0x10283528; |
|
41 const TInt32 KImplementationType = 0x10283529; |
|
42 const TInt32 KCreatorNameType = 0x1028352A; |
|
43 const TInt32 KIsFIPSApprovedType = 0x1028352B; |
|
44 const TInt32 KIsHardwareSupportedType = 0x1028352C; |
|
45 const TInt32 KMaxConcurrencySupportedType = 0x1028352D; |
|
46 const TInt32 KLatencyType = 0x1028352E; |
|
47 const TInt32 KThroughputType = 0x1028352F; |
|
48 const TInt32 KBlockSizeType = 0x10283530; |
|
49 const TInt32 KOutputSizeType = 0x10283531; |
|
50 const TInt32 KSupportedOperationModesType = 0x10283532; |
|
51 const TInt32 KBlockingModeType = 0x10283533; |
|
52 const TInt32 KMaximumKeyLengthType = 0x10283534; |
|
53 const TInt32 KSupportedPaddingModesType = 0x10283535; |
|
54 const TInt32 KKeySupportModeType = 0x10283536; |
|
55 const TInt32 KConcurrencyType = 0x10283537; |
|
56 const TInt32 KExclusiveUseType = 0x10283538; |
|
57 |
|
58 /** |
|
59 The following are the characteristic UIDs which should be used for Rules-based Selector |
|
60 */ |
|
61 const TUid KNoneUid = {0x00000000}; |
|
62 const TUid KInterfaceTypeUid = {KInterfaceType}; |
|
63 const TUid KAlgorithmTypeUid = {KAlgorithmType}; |
|
64 const TUid KImplementationTypeUid = {KImplementationType}; |
|
65 const TUid KCreatorNameTypeUid = {KCreatorNameType}; |
|
66 const TUid KIsFIPSApprovedTypeUid = {KIsFIPSApprovedType}; |
|
67 const TUid KIsHardwareSupportedTypeUid = {KIsHardwareSupportedType}; |
|
68 const TUid KMaxConcurrencySupportedTypeUid = {KMaxConcurrencySupportedType}; |
|
69 const TUid KLatencyTypeUid = {KLatencyType}; |
|
70 const TUid KThroughputTypeUid = {KThroughputType}; |
|
71 const TUid KBlockSizeTypeUid = {KBlockSizeType}; |
|
72 const TUid KOutputSizeTypeUid = {KOutputSizeType}; |
|
73 const TUid KSupportedOperationModesTypeUid = {KSupportedOperationModesType}; |
|
74 const TUid KBlockingModeTypeUid = {KBlockingModeType}; |
|
75 const TUid KMaximumKeyLengthTypeUid = {KMaximumKeyLengthType}; |
|
76 const TUid KSupportedPaddingModesTypeUid = {KSupportedPaddingModesType}; |
|
77 const TUid KKeySupportModeTypeUid = {KKeySupportModeType}; |
|
78 const TUid KConcurrencyTypeUid = {KConcurrencyType}; |
|
79 const TUid KExclusiveUseTypeUid = {KExclusiveUseType}; |
|
80 |
|
81 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT |
|
82 const TInt32 KMacModeType = 0x2001ED9F; |
|
83 const TUid KMacModeTypeUid = {KMacModeType}; |
|
84 #endif |
|
85 |
|
86 |
|
87 typedef TAny TCharacteristics; |
|
88 |
|
89 /** |
|
90 Common characteristics for all plug-in interface types. |
|
91 |
|
92 This MUST be the first element of each characteristics "sub-class" to |
|
93 allow sub-classes to be cast directly to a TCommonCharacteristics. This |
|
94 is used instead of inheritance because it enables arrays of characteristics |
|
95 objects to be defined as static constant data. |
|
96 */ |
|
97 class TCommonCharacteristics |
|
98 { |
|
99 public: |
|
100 |
|
101 /** |
|
102 * @internalComponent |
|
103 * |
|
104 * Externalises common characteristics to a write stream. |
|
105 * |
|
106 * @param aStream Stream to which the object should be externalised. |
|
107 */ |
|
108 void ExternalizeL(RWriteStream& aStream) const; |
|
109 |
|
110 public: |
|
111 /** |
|
112 Interface UID, e.g hash, symmetric cipher |
|
113 */ |
|
114 TInt32 iInterfaceUID; |
|
115 |
|
116 /** |
|
117 Algorithm UID, e.g MD2, 3DES |
|
118 */ |
|
119 TInt32 iAlgorithmUID; |
|
120 |
|
121 /** |
|
122 Implementaion UID |
|
123 */ |
|
124 TInt32 iImplementationUID; |
|
125 |
|
126 /** |
|
127 Creator name |
|
128 */ |
|
129 const TRomLitC16* iCreatorName; |
|
130 |
|
131 /** |
|
132 whether the implementation is FIPS compliant |
|
133 */ |
|
134 TBool iIsFIPSApproved; |
|
135 |
|
136 /** |
|
137 whether the implementation is a hardware one |
|
138 */ |
|
139 TBool iIsHardwareSupported; |
|
140 |
|
141 /** |
|
142 the Maximum concurrent operation supported |
|
143 */ |
|
144 TUint iMaxConcurrencySupported; |
|
145 |
|
146 /** |
|
147 the Algorithm Name |
|
148 */ |
|
149 const TRomLitC16* iAlgorithmName; |
|
150 |
|
151 /** |
|
152 The Latency |
|
153 */ |
|
154 TInt iLatency; |
|
155 |
|
156 /** |
|
157 the Throughput |
|
158 */ |
|
159 TInt iThroughput; |
|
160 }; |
|
161 |
|
162 /** |
|
163 Hash Characteristics |
|
164 */ |
|
165 class THashCharacteristics |
|
166 { |
|
167 public: |
|
168 /** |
|
169 * @internalComponent |
|
170 * |
|
171 * Externalises hash characteristics to a write stream. |
|
172 * |
|
173 * @param aStream Stream to which the object should be externalised. |
|
174 **/ |
|
175 void ExternalizeL(RWriteStream& aStream) const; |
|
176 |
|
177 /** |
|
178 * @deprecated |
|
179 * |
|
180 * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in |
|
181 * by searching through iSupportedOperationModes for the UID value corresponding |
|
182 * to the aOperationMode parameter. |
|
183 * |
|
184 * @param aOperationMode The UID of the operation mode to test |
|
185 * @return ETrue if the operation mode is supported; otherwise, EFalse is returned. |
|
186 */ |
|
187 IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const; |
|
188 |
|
189 public: |
|
190 /** |
|
191 Common characteristics |
|
192 */ |
|
193 TCommonCharacteristics cmn; |
|
194 |
|
195 /** |
|
196 The internal block size of the hash in bits |
|
197 */ |
|
198 TUint iBlockSize; |
|
199 |
|
200 /** |
|
201 the output size of the hash in bits |
|
202 */ |
|
203 TUint iOutputSize; |
|
204 |
|
205 /** |
|
206 The list of supported Operation modes |
|
207 */ |
|
208 const TInt32* iSupportedOperationModes; |
|
209 |
|
210 /** |
|
211 Number of the supported Operation mode |
|
212 */ |
|
213 TUint iOperationModeNum; |
|
214 }; |
|
215 |
|
216 /** |
|
217 Random Characteristics |
|
218 */ |
|
219 class TRandomCharacteristics |
|
220 { |
|
221 public: |
|
222 /** |
|
223 * @internalComponent |
|
224 * |
|
225 * Externalises random characteristics to a write stream. |
|
226 * |
|
227 * @param aStream Stream to which the object should be externalised. |
|
228 **/ |
|
229 void ExternalizeL(RWriteStream& aStream) const; |
|
230 public: |
|
231 /** |
|
232 Common characteristics |
|
233 */ |
|
234 TCommonCharacteristics cmn; |
|
235 |
|
236 /** |
|
237 The bit map of blocking non-blocking mode |
|
238 */ |
|
239 TUint iBlockingMode; |
|
240 }; |
|
241 |
|
242 |
|
243 /** |
|
244 Symmetric Cipher Chararcteristics |
|
245 */ |
|
246 class TSymmetricCipherCharacteristics |
|
247 { |
|
248 public: |
|
249 /** |
|
250 * @internalComponent |
|
251 * |
|
252 * Externalises symmetric cipher characteristics to a write stream. |
|
253 * |
|
254 * @param aStream Stream to which the object should be externalised. |
|
255 **/ |
|
256 void ExternalizeL(RWriteStream& aStream) const; |
|
257 |
|
258 /** |
|
259 Determines whether an operation mode (e.g. CBC) is supported by the plug-in |
|
260 by searching through iSupportedOperationModes for the UID value corresponding |
|
261 to the aOperationMode parameter. |
|
262 @param aOperationMode The UID of the operation mode to test |
|
263 @return ETrue if the operation mode is supported; otherwise, EFalse is returned. |
|
264 */ |
|
265 IMPORT_C TBool IsOperationModeSupported(TUid aOperationMode) const; |
|
266 |
|
267 /** |
|
268 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
269 by searching through iSupportedPaddingModes for the UID value corresponding |
|
270 to the aPaddingMode parameter. |
|
271 @param aPaddingMode The UID of the padding mode to test. |
|
272 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
273 */ |
|
274 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
275 |
|
276 public: |
|
277 /** |
|
278 Common characteristics |
|
279 */ |
|
280 TCommonCharacteristics cmn; |
|
281 |
|
282 /** |
|
283 The maximum key length in bits |
|
284 */ |
|
285 TUint iMaximumKeyLength; |
|
286 |
|
287 /** |
|
288 The block size of the cipher in bits |
|
289 */ |
|
290 TUint iBlockSize; |
|
291 |
|
292 /** |
|
293 The list of supported padding modes |
|
294 */ |
|
295 const TInt32* iSupportedPaddingModes; |
|
296 |
|
297 /** |
|
298 Number of the supported padding mode |
|
299 */ |
|
300 TUint iPaddingModeNum; |
|
301 |
|
302 /** |
|
303 The list of supported Operation modes |
|
304 */ |
|
305 const TInt32* iSupportedOperationModes; |
|
306 |
|
307 /** |
|
308 Number of the supported Operation mode |
|
309 */ |
|
310 TUint iOperationModeNum; |
|
311 |
|
312 /** |
|
313 The supported key mode bit map. e.g. extern key, internal key or both |
|
314 */ |
|
315 TInt iKeySupportMode; |
|
316 }; |
|
317 |
|
318 /** |
|
319 Asymmetric Cipher Characteristics |
|
320 */ |
|
321 class TAsymmetricCipherCharacteristics |
|
322 { |
|
323 public: |
|
324 /** |
|
325 * @internalComponent |
|
326 * |
|
327 * Externalises asymmetric cipher characteristics to a write stream. |
|
328 * |
|
329 * @param aStream Stream to which the object should be externalised. |
|
330 **/ |
|
331 void ExternalizeL(RWriteStream& aStream) const; |
|
332 |
|
333 /** |
|
334 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
335 by searching through iSupportedPaddingModes for the UID value corresponding |
|
336 to the aPaddingMode parameter. |
|
337 @param aPaddingMode The UID of the padding mode to test. |
|
338 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
339 */ |
|
340 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
341 |
|
342 public: |
|
343 /** |
|
344 Common characteristics |
|
345 */ |
|
346 TCommonCharacteristics cmn; |
|
347 /** |
|
348 The maximum key length in bits |
|
349 */ |
|
350 TUint iMaximumKeyLength; |
|
351 |
|
352 /** |
|
353 The list of supported padding modes |
|
354 */ |
|
355 const TInt32* iSupportedPaddingModes; |
|
356 |
|
357 /** |
|
358 Number of the supported padding mode |
|
359 */ |
|
360 TInt iPaddingModeNum; |
|
361 |
|
362 /** |
|
363 The supported key mode bit map. e.g. extern key, internal key or both |
|
364 */ |
|
365 TInt iKeySupportMode; |
|
366 }; |
|
367 |
|
368 /** |
|
369 Signature Characteristics |
|
370 */ |
|
371 class TAsymmetricSignatureCharacteristics |
|
372 { |
|
373 public: |
|
374 /** |
|
375 * @internalComponent |
|
376 * |
|
377 * Externalises signature characteristics to a write stream. |
|
378 * |
|
379 * @param aStream Stream to which the object should be externalised. |
|
380 **/ |
|
381 void ExternalizeL(RWriteStream& aStream) const; |
|
382 |
|
383 /** |
|
384 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
385 by searching through iSupportedPaddingModes for the UID value corresponding |
|
386 to the aPaddingMode parameter. |
|
387 @param aPaddingMode The UID of the padding mode to test. |
|
388 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
389 */ |
|
390 IMPORT_C TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
391 |
|
392 public: |
|
393 /** |
|
394 Common characteristics |
|
395 */ |
|
396 TCommonCharacteristics cmn; |
|
397 |
|
398 /** |
|
399 The maximum key length in bits |
|
400 */ |
|
401 TUint iMaximumKeyLength; |
|
402 |
|
403 /** |
|
404 The list of supported padding modes |
|
405 */ |
|
406 const TInt32* iSupportedPaddingModes; |
|
407 |
|
408 /** |
|
409 Number of the supported padding mode |
|
410 */ |
|
411 TInt iPaddingModeNum; |
|
412 |
|
413 /** |
|
414 The supported key mode bit map. e.g. extern key, internal key or both |
|
415 */ |
|
416 TInt iKeySupportMode; |
|
417 }; |
|
418 |
|
419 |
|
420 /** |
|
421 Key Agreement Characteristics |
|
422 */ |
|
423 class TKeyAgreementCharacteristics |
|
424 { |
|
425 public: |
|
426 /** |
|
427 * @internalComponent |
|
428 * |
|
429 * Externalises key agreement characteristics to a write stream. |
|
430 * |
|
431 * @param aStream Stream to which the object should be externalised. |
|
432 **/ |
|
433 void ExternalizeL(RWriteStream& aStream) const; |
|
434 |
|
435 public: |
|
436 /** |
|
437 Common characteristics |
|
438 */ |
|
439 TCommonCharacteristics cmn; |
|
440 }; |
|
441 |
|
442 /** |
|
443 Asymmetric Keypair Generator Characteristics |
|
444 */ |
|
445 class TAsymmetricKeypairGeneratorCharacteristics |
|
446 { |
|
447 public: |
|
448 /** |
|
449 * @internalComponent |
|
450 * |
|
451 * Externalises key pair generator characteristics to a write stream. |
|
452 * |
|
453 * @param aStream Stream to which the object should be externalised. |
|
454 **/ |
|
455 void ExternalizeL(RWriteStream& aStream) const; |
|
456 |
|
457 public: |
|
458 /** |
|
459 Common characteristics |
|
460 */ |
|
461 TCommonCharacteristics cmn; |
|
462 |
|
463 /** |
|
464 The maximum key length that may be generarted in bits |
|
465 */ |
|
466 TUint iMaximumKeyLength; |
|
467 }; |
|
468 |
|
469 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT |
|
470 /** |
|
471 * Mac Characteristics |
|
472 */ |
|
473 class TMacCharacteristics |
|
474 { |
|
475 public: |
|
476 /** |
|
477 * @internalComponent |
|
478 * |
|
479 * Externalises hash characteristics to a write stream. |
|
480 * |
|
481 * @param aStream Stream to which the object should be externalised. |
|
482 */ |
|
483 void ExternalizeL(RWriteStream& aStream) const; |
|
484 |
|
485 public: |
|
486 |
|
487 /** |
|
488 * Common Characteristics |
|
489 */ |
|
490 TCommonCharacteristics iMacChar; |
|
491 |
|
492 /** |
|
493 * Mac Mode Type UID will be used to select the plug-in implementations. |
|
494 * The mode can be either hash or symmetric cipher based. |
|
495 */ |
|
496 TInt32 iMacMode; |
|
497 |
|
498 /** |
|
499 * The following pointers are mutually exclusive in their usage and anytime |
|
500 * only one will be initialised depending upon the Mac mode type the plug-in |
|
501 * supports, those not supported will be NULL. |
|
502 */ |
|
503 |
|
504 /** |
|
505 * Initialised if 'iMacMode' is Hash based otherwise will be NULL. |
|
506 */ |
|
507 const THashCharacteristics* iHashAlgorithmChar; |
|
508 /** |
|
509 * Initialised if 'iMacMode' is Symmetric Cipher based otherwise will be NULL. |
|
510 */ |
|
511 const TSymmetricCipherCharacteristics* iCipherAlgorithmChar; |
|
512 }; |
|
513 #endif |
|
514 } |
|
515 #endif //__CRYPTOAPI_PLUGINCHARACTERISTICS_H__ |