|
1 /* |
|
2 * Copyright (c) 2007-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 * crypto characteristics |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedAll |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __CRYPTOCHARACTERISTICS_H__ |
|
27 #define __CRYPTOCHARACTERISTICS_H__ |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32hashtab.h> |
|
31 #include <cryptospi/plugincharacteristics.h> |
|
32 #include <cryptospi/cryptobaseapi.h> |
|
33 |
|
34 |
|
35 namespace CryptoSpi |
|
36 { |
|
37 |
|
38 /** |
|
39 The class holds the common characteristics of an interface. |
|
40 which is used for internalization. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CCharacteristics) : public CBase |
|
43 { |
|
44 public: |
|
45 /** |
|
46 Destructor |
|
47 */ |
|
48 virtual ~CCharacteristics(); |
|
49 |
|
50 /** |
|
51 Internalize this object from the supplied stream. |
|
52 |
|
53 @param aStream Stream to read CCharacteristics from. |
|
54 */ |
|
55 virtual void InternalizeL(RReadStream& aStream); |
|
56 |
|
57 protected: |
|
58 /** |
|
59 * @internalComponent |
|
60 * |
|
61 * Constructor |
|
62 */ |
|
63 CCharacteristics(); |
|
64 |
|
65 public: |
|
66 /** |
|
67 Interface UID, e.g hash, symmetric cipher |
|
68 */ |
|
69 TInt32 iInterfaceUid; |
|
70 |
|
71 /** |
|
72 Algorithm UID, e.g MD2, 3DES |
|
73 */ |
|
74 TInt32 iAlgorithmUid; |
|
75 |
|
76 /** |
|
77 Implementaion UID |
|
78 */ |
|
79 TInt32 iImplementationUid; |
|
80 |
|
81 /** |
|
82 Creator name |
|
83 */ |
|
84 RBuf iCreatorName; |
|
85 |
|
86 /** |
|
87 whether the implementation is FIPS compliant |
|
88 */ |
|
89 TBool iIsFIPSApproved; |
|
90 |
|
91 /** |
|
92 whether the implementation is a hardware one |
|
93 */ |
|
94 TBool iIsHardwareSupported; |
|
95 |
|
96 /** |
|
97 the Maximum concurrent operation supported |
|
98 */ |
|
99 TUint iMaxConcurrencySupported; |
|
100 |
|
101 /** |
|
102 the Algorithm Name |
|
103 */ |
|
104 RBuf iAlgorithmName; |
|
105 |
|
106 /** |
|
107 The Latency |
|
108 */ |
|
109 TInt iLatency; |
|
110 |
|
111 /** |
|
112 the Throughput |
|
113 */ |
|
114 TInt iThroughput; |
|
115 }; |
|
116 |
|
117 /** |
|
118 The class holds the hash characteristics. |
|
119 which is used for internalization. |
|
120 */ |
|
121 NONSHARABLE_CLASS(CHashCharacteristics) : public CCharacteristics |
|
122 { |
|
123 public: |
|
124 /** |
|
125 @internalComponent |
|
126 |
|
127 Create a new instance of CHashCharacteristics. |
|
128 |
|
129 @return the pointer of the hash characteristic |
|
130 */ |
|
131 static CHashCharacteristics* NewL(); |
|
132 |
|
133 /** |
|
134 @internalComponent |
|
135 |
|
136 Create a new instance of CHashCharacteristics, |
|
137 Leave it on the cleanup stack. |
|
138 |
|
139 @return the pointer of the hash characteristic |
|
140 */ |
|
141 static CHashCharacteristics* NewLC(); |
|
142 |
|
143 /** |
|
144 Destructor |
|
145 */ |
|
146 virtual ~CHashCharacteristics(); |
|
147 |
|
148 /** |
|
149 Internalize this object from the supplied stream. |
|
150 |
|
151 @param aStream Stream to read CHashCharacteristics from. |
|
152 */ |
|
153 virtual void InternalizeL(RReadStream& aStream); |
|
154 |
|
155 /** |
|
156 * @internalComponent |
|
157 * |
|
158 * Determines whether an operation mode (e.g. HMAC) is supported by the plug-in |
|
159 * by searching through iSupportedOperationModes for the UID value corresponding |
|
160 * to the aOperationMode parameter. |
|
161 * @param aOperationMode The UID of the operation mode to test |
|
162 * @return ETrue if the operation mode is supported; otherwise, EFalse is returned. |
|
163 */ |
|
164 TBool IsOperationModeSupported(TUid aOperationMode) const; |
|
165 |
|
166 private: |
|
167 /** |
|
168 Constructor |
|
169 */ |
|
170 CHashCharacteristics(); |
|
171 public: |
|
172 /** |
|
173 The internal block size of the hash in bits |
|
174 */ |
|
175 TUint iBlockSize; |
|
176 |
|
177 /** |
|
178 the output size of the hash in bytes |
|
179 */ |
|
180 TUint iOutputSize; |
|
181 |
|
182 /** |
|
183 The list of supported Operation modes |
|
184 */ |
|
185 RArray<TInt32> iSupportedOperationModes; |
|
186 }; |
|
187 |
|
188 |
|
189 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT |
|
190 |
|
191 /** |
|
192 * The class holds MAC characteristics which is used for internalization |
|
193 * in CryptoSpi framework. |
|
194 */ |
|
195 NONSHARABLE_CLASS(CMacCharacteristics) : public CCharacteristics |
|
196 { |
|
197 public: |
|
198 /** |
|
199 * @internalComponent |
|
200 * |
|
201 * Create a new instance of CMacCharacteristics. |
|
202 * |
|
203 * @return the pointer of the Mac characteristic |
|
204 */ |
|
205 static CMacCharacteristics* NewL(); |
|
206 |
|
207 /** |
|
208 * @internalComponent |
|
209 * |
|
210 * Create a new instance of CMacCharacteristics, Leave it on the cleanup stack. |
|
211 * |
|
212 * @return the pointer of the Mac characteristic |
|
213 */ |
|
214 static CMacCharacteristics* NewLC(); |
|
215 |
|
216 /** |
|
217 * Destructor |
|
218 */ |
|
219 virtual ~CMacCharacteristics(); |
|
220 |
|
221 /** |
|
222 * Internalize this object from the supplied stream. |
|
223 * |
|
224 * @param aStream Stream to read CMacCharacteristics from. |
|
225 */ |
|
226 virtual void InternalizeL(RReadStream& aStream); |
|
227 |
|
228 private: |
|
229 /** |
|
230 * Constructor |
|
231 */ |
|
232 CMacCharacteristics(); |
|
233 |
|
234 public: |
|
235 /** |
|
236 * The Mac mode : Hash based, Cipher based etc. |
|
237 */ |
|
238 TInt32 iMacMode; |
|
239 |
|
240 /** |
|
241 * Characteristics of the underlying MAC algorithm |
|
242 */ |
|
243 CCharacteristics* iAlgorithmChar; |
|
244 }; |
|
245 |
|
246 #endif |
|
247 |
|
248 /** |
|
249 The class holds the random characteristics. |
|
250 which is used for internalization. |
|
251 */ |
|
252 NONSHARABLE_CLASS(CRandomCharacteristics) : public CCharacteristics |
|
253 { |
|
254 public: |
|
255 /** |
|
256 @internalComponent |
|
257 |
|
258 Create a new instance of CRandomCharacteristics. |
|
259 |
|
260 @return the pointer of the random characteristic |
|
261 */ |
|
262 static CRandomCharacteristics* NewL(); |
|
263 |
|
264 /** |
|
265 @internalComponent |
|
266 |
|
267 Create a new instance of CRandomCharacteristics, |
|
268 and leave it on the cleanup stack. |
|
269 |
|
270 @return the pointer of the random characteristic |
|
271 */ |
|
272 static CRandomCharacteristics* NewLC(); |
|
273 |
|
274 /** |
|
275 Destructor |
|
276 */ |
|
277 virtual ~CRandomCharacteristics(); |
|
278 |
|
279 /** |
|
280 Internalize this object from the supplied stream. |
|
281 |
|
282 @param aStream Stream to read CRandomCharacteristics from. |
|
283 */ |
|
284 virtual void InternalizeL(RReadStream& aStream); |
|
285 |
|
286 private: |
|
287 /** |
|
288 Constructor |
|
289 */ |
|
290 CRandomCharacteristics(); |
|
291 |
|
292 public: |
|
293 /** |
|
294 The bit map of blocking non-blocking mode |
|
295 */ |
|
296 TUint iBlockingMode; |
|
297 }; |
|
298 |
|
299 /** |
|
300 The class holds the symmetric cipher characteristics. |
|
301 which is used for internalization. |
|
302 */ |
|
303 NONSHARABLE_CLASS(CSymmetricCipherCharacteristics) : public CCharacteristics |
|
304 { |
|
305 public: |
|
306 /** |
|
307 @internalComponent |
|
308 |
|
309 Create a new instance of CSymmetricCipherCharacteristics. |
|
310 |
|
311 @return the pointer of the symmetric cipher characteristic |
|
312 */ |
|
313 static CSymmetricCipherCharacteristics* NewL(); |
|
314 |
|
315 /** |
|
316 @internalComponent |
|
317 |
|
318 Create a new instance of CSymmetricCipherCharacteristics. |
|
319 Leave it on the cleanup stack. |
|
320 |
|
321 @return the pointer of the symmetric cipher characteristic |
|
322 */ |
|
323 static CSymmetricCipherCharacteristics* NewLC(); |
|
324 |
|
325 /** |
|
326 Destructor |
|
327 */ |
|
328 virtual ~CSymmetricCipherCharacteristics(); |
|
329 |
|
330 /** |
|
331 Internalize this object from the supplied stream. |
|
332 |
|
333 @param aStream Stream to read CSymmetricCipherCharacteristics from. |
|
334 */ |
|
335 virtual void InternalizeL(RReadStream& aStream); |
|
336 |
|
337 /** |
|
338 @internalComponent |
|
339 |
|
340 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
341 by searching through iSupportedPaddingModes for the UID value corresponding |
|
342 to the aPaddingMode parameter. |
|
343 @param aPaddingMode The UID of the padding mode to test. |
|
344 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
345 */ |
|
346 TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
347 |
|
348 /** |
|
349 @internalComponent |
|
350 |
|
351 Determines whether an operation mode (e.g. HMAC) is supported by the plug-in |
|
352 by searching through iSupportedOperationModes for the UID value corresponding |
|
353 to the aOperationMode parameter. |
|
354 @param aOperationMode The UID of the operation mode to test |
|
355 @return ETrue if the operation mode is supported; otherwise, EFalse is returned. |
|
356 */ |
|
357 TBool IsOperationModeSupported(TUid aOperationMode) const; |
|
358 |
|
359 private: |
|
360 /** |
|
361 Constructor |
|
362 */ |
|
363 CSymmetricCipherCharacteristics(); |
|
364 |
|
365 public: |
|
366 /** |
|
367 The maximum key length in bits |
|
368 */ |
|
369 TUint iMaximumKeyLength; |
|
370 |
|
371 /** |
|
372 The block size of the cipher in bytes |
|
373 */ |
|
374 TUint iBlockSize; |
|
375 |
|
376 /** |
|
377 The list of supported padding modes |
|
378 */ |
|
379 RArray<TInt32> iSupportedPaddingModes; |
|
380 |
|
381 /** |
|
382 The list of supported Operation modes |
|
383 */ |
|
384 RArray<TInt32> iSupportedOperationModes; |
|
385 |
|
386 /** |
|
387 The supported key mode bit map. e.g. extern key, internal key or both |
|
388 */ |
|
389 TInt iKeySupportMode; |
|
390 }; |
|
391 |
|
392 /** |
|
393 The class holds the asymmetric cipher characteristics. |
|
394 which is used for internalization. |
|
395 */ |
|
396 NONSHARABLE_CLASS(CAsymmetricCipherCharacteristics) : public CCharacteristics |
|
397 { |
|
398 public: |
|
399 /** |
|
400 @internalComponent |
|
401 |
|
402 Create a new instance of CAsymmetricCipherCharacteristics. |
|
403 |
|
404 @return the pointer of the asymmetric cipher characteristic |
|
405 */ |
|
406 static CAsymmetricCipherCharacteristics* NewL(); |
|
407 |
|
408 /** |
|
409 @internalComponent |
|
410 |
|
411 Create a new instance of CAsymmetricCipherCharacteristics. |
|
412 Leave it on the cleanup stack. |
|
413 |
|
414 @return the pointer of the asymmetric cipher characteristic |
|
415 */ |
|
416 static CAsymmetricCipherCharacteristics* NewLC(); |
|
417 |
|
418 /** |
|
419 Destructor |
|
420 */ |
|
421 virtual ~CAsymmetricCipherCharacteristics(); |
|
422 |
|
423 /** |
|
424 Internalize this object from the supplied stream. |
|
425 |
|
426 @param aStream Stream to read CAsymmetricCipherCharacteristics from. |
|
427 */ |
|
428 virtual void InternalizeL(RReadStream& aStream); |
|
429 |
|
430 /** |
|
431 @internalComponent |
|
432 |
|
433 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
434 by searching through iSupportedPaddingModes for the UID value corresponding |
|
435 to the aPaddingMode parameter. |
|
436 @param aPaddingMode The UID of the padding mode to test. |
|
437 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
438 */ |
|
439 TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
440 |
|
441 private: |
|
442 /** |
|
443 Constructor |
|
444 */ |
|
445 CAsymmetricCipherCharacteristics(); |
|
446 |
|
447 public: |
|
448 /** |
|
449 The maximum key length in bits |
|
450 */ |
|
451 TUint iMaximumKeyLength; |
|
452 |
|
453 /** |
|
454 The list of supported padding modes |
|
455 */ |
|
456 RArray<TInt32> iSupportedPaddingModes; |
|
457 |
|
458 /** |
|
459 The supported key mode bit map. e.g. extern key, internal key or both |
|
460 */ |
|
461 TInt iKeySupportMode; |
|
462 }; |
|
463 |
|
464 |
|
465 /** |
|
466 The class holds the signature characteristics. |
|
467 which is used for internalization. |
|
468 */ |
|
469 NONSHARABLE_CLASS(CAsymmetricSignatureCharacteristics) : public CCharacteristics |
|
470 { |
|
471 public: |
|
472 /** |
|
473 @internalComponent |
|
474 |
|
475 Create a new instance of CAsymmetricSignatureCharacteristics. |
|
476 |
|
477 @return the pointer of the asymmetric signature characteristic |
|
478 */ |
|
479 static CAsymmetricSignatureCharacteristics* NewL(); |
|
480 |
|
481 /** |
|
482 @internalComponent |
|
483 |
|
484 Create a new instance of CAsymmetricSignatureCharacteristics. |
|
485 Leave it on the cleanup stack. |
|
486 |
|
487 @return the pointer of the asymmetric signature characteristic |
|
488 */ |
|
489 static CAsymmetricSignatureCharacteristics* NewLC(); |
|
490 |
|
491 /** |
|
492 Destructor |
|
493 */ |
|
494 virtual ~CAsymmetricSignatureCharacteristics(); |
|
495 |
|
496 /** |
|
497 Internalize this object from the supplied stream. |
|
498 |
|
499 @param aStream Stream to read CAsymmetricSignatureCharacteristics from. |
|
500 */ |
|
501 virtual void InternalizeL(RReadStream& aStream); |
|
502 |
|
503 /** |
|
504 @internalComponent |
|
505 |
|
506 Determines whether a padding mode (e.g. PKCS7) is supported by the plug-in |
|
507 by searching through iSupportedPaddingModes for the UID value corresponding |
|
508 to the aPaddingMode parameter. |
|
509 @param aPaddingMode The UID of the padding mode to test. |
|
510 @return ETrue if the padding mode is supported; otherwise, EFalse is returned. |
|
511 */ |
|
512 TBool IsPaddingModeSupported(TUid aPaddingMode) const; |
|
513 |
|
514 private: |
|
515 /** |
|
516 Constructor |
|
517 */ |
|
518 CAsymmetricSignatureCharacteristics(); |
|
519 |
|
520 public: |
|
521 /** |
|
522 The maximum key length in bits |
|
523 */ |
|
524 TUint iMaximumKeyLength; |
|
525 |
|
526 /** |
|
527 The list of supported padding modes |
|
528 */ |
|
529 RArray<TInt32> iSupportedPaddingModes; |
|
530 |
|
531 /** |
|
532 The supported key mode bit map. e.g. extern key, internal key or both |
|
533 */ |
|
534 TInt iKeySupportMode; |
|
535 }; |
|
536 |
|
537 /** |
|
538 The class holds the key agreement characteristics. |
|
539 which is used for internalization. |
|
540 */ |
|
541 NONSHARABLE_CLASS(CKeyAgreementCharacteristics) : public CCharacteristics |
|
542 { |
|
543 public: |
|
544 /** |
|
545 @internalComponent |
|
546 |
|
547 Create a new instance of CKeyAgreementCharacteristics. |
|
548 |
|
549 @return the pointer of the key agreement characteristic |
|
550 */ |
|
551 static CKeyAgreementCharacteristics* NewL(); |
|
552 |
|
553 /** |
|
554 @internalComponent |
|
555 |
|
556 Create a new instance of CKeyAgreementCharacteristics. |
|
557 Leave it on the cleanup stack. |
|
558 |
|
559 @return the pointer of the key agreement characteristic |
|
560 */ |
|
561 static CKeyAgreementCharacteristics* NewLC(); |
|
562 |
|
563 /** |
|
564 Destructor |
|
565 */ |
|
566 virtual ~CKeyAgreementCharacteristics(); |
|
567 |
|
568 /** |
|
569 Internalize this object from the supplied stream. |
|
570 |
|
571 @param aStream Stream to read CKeyAgreementCharacteristics from. |
|
572 */ |
|
573 virtual void InternalizeL(RReadStream& aStream); |
|
574 |
|
575 private: |
|
576 /** |
|
577 Constructor |
|
578 */ |
|
579 CKeyAgreementCharacteristics(); |
|
580 }; |
|
581 |
|
582 /** |
|
583 The class holds the key pair generator characteristics. |
|
584 which is used for internalization. |
|
585 */ |
|
586 NONSHARABLE_CLASS(CKeypairGeneratorCharacteristics) : public CCharacteristics |
|
587 { |
|
588 public: |
|
589 /** |
|
590 @internalComponent |
|
591 |
|
592 Create a new instance of CKeypairGeneratorCharacteristics. |
|
593 |
|
594 @return the pointer of the keypair generator characteristic |
|
595 */ |
|
596 static CKeypairGeneratorCharacteristics* NewL(); |
|
597 |
|
598 /** |
|
599 @internalComponent |
|
600 |
|
601 Create a new instance of CKeypairGeneratorCharacteristics. |
|
602 Leave it on the cleanup stack. |
|
603 |
|
604 @return the pointer of the keypair generator characteristic |
|
605 */ |
|
606 static CKeypairGeneratorCharacteristics* NewLC(); |
|
607 |
|
608 /** |
|
609 Destructor |
|
610 */ |
|
611 virtual ~CKeypairGeneratorCharacteristics(); |
|
612 |
|
613 /** |
|
614 Internalize this object from the supplied stream. |
|
615 |
|
616 @param aStream Stream to read CKeyAgreementCharacteristics from. |
|
617 */ |
|
618 virtual void InternalizeL(RReadStream& aStream); |
|
619 |
|
620 private: |
|
621 /** |
|
622 Constructor |
|
623 */ |
|
624 CKeypairGeneratorCharacteristics(); |
|
625 public: |
|
626 /** |
|
627 The maximum key length in bits |
|
628 */ |
|
629 TUint iMaximumKeyLength; |
|
630 }; |
|
631 |
|
632 /** |
|
633 The class holds characteristics and dll index. |
|
634 which is used for internalization. |
|
635 */ |
|
636 NONSHARABLE_CLASS(CCharacteristicsAndPluginName) : public CBase |
|
637 { |
|
638 public: |
|
639 /** |
|
640 @internalComponent |
|
641 |
|
642 Create a new instance of CKeypairGeneratorCharacteristics. |
|
643 |
|
644 @param aInterface the interface uid |
|
645 @return the pointer of the keypair generator characteristic |
|
646 */ |
|
647 static CCharacteristicsAndPluginName* NewL(TInt32 aInterface); |
|
648 |
|
649 /** |
|
650 @internalComponent |
|
651 |
|
652 Create a new instance of CKeypairGeneratorCharacteristics. |
|
653 Leave it on the cleanup stack. |
|
654 |
|
655 @param aInterface the interface uid |
|
656 @return the pointer of the keypair generator characteristic |
|
657 */ |
|
658 static CCharacteristicsAndPluginName* NewLC(TInt32 aInterface); |
|
659 |
|
660 /** |
|
661 Destructor |
|
662 */ |
|
663 virtual ~CCharacteristicsAndPluginName(); |
|
664 |
|
665 /** |
|
666 @internalComponent |
|
667 |
|
668 Internalize this object from the supplied stream. |
|
669 |
|
670 @param aStream Stream to read CCharacteristicsAndPluginName from. |
|
671 */ |
|
672 void InternalizeL(RReadStream& aStream); |
|
673 |
|
674 protected: |
|
675 /** |
|
676 * @internalComponent |
|
677 * |
|
678 * Constructors |
|
679 */ |
|
680 CCharacteristicsAndPluginName(); |
|
681 /** @internalComponent */ |
|
682 void ConstructL(TInt32 aInterface); |
|
683 |
|
684 public: |
|
685 /** |
|
686 The characteristic of the crypto implementation |
|
687 */ |
|
688 CCharacteristics* iCharacteristic; |
|
689 |
|
690 /** |
|
691 The extended characteristic of the crypto implementation |
|
692 */ |
|
693 CExtendedCharacteristics* iExtendedCharacteristic; |
|
694 |
|
695 /** |
|
696 The name of the plugin dll which contains this implementation |
|
697 */ |
|
698 TFileName iDllName; |
|
699 }; |
|
700 } |
|
701 #endif //__CRYPTOCHARACTERISTICS_H__ |
|
702 |
|
703 |
|
704 |