equal
deleted
inserted
replaced
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the |
15 * ** IMPORTANT ** API's in this file are published to 3rd party developers via the |
16 * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted. |
16 * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted. |
17 * Asymmetric keys implementation |
17 * Asymmetric keys implementation |
18 * |
18 * |
19 */ |
19 */ |
20 |
20 |
21 |
21 |
22 |
|
23 |
|
24 /** |
22 /** |
25 @file |
23 @file |
26 @internalAll |
24 @publishedAll |
|
25 @released |
27 */ |
26 */ |
28 |
27 |
29 #ifndef __ASYMMETRICKEYS_H__ |
28 #ifndef __ASYMMETRICKEYS_H__ |
30 #define __ASYMMETRICKEYS_H__ |
29 #define __ASYMMETRICKEYS_H__ |
31 |
30 |
34 #include <bigint.h> |
33 #include <bigint.h> |
35 |
34 |
36 /** |
35 /** |
37 * Defines the various ways of representing supported RSA private keys. |
36 * Defines the various ways of representing supported RSA private keys. |
38 * |
37 * |
39 * @publishedPartner |
|
40 * @released |
|
41 */ |
38 */ |
42 enum TRSAPrivateKeyType |
39 enum TRSAPrivateKeyType |
43 { |
40 { |
44 /** |
41 /** |
45 * Standard type of RSA private key |
42 * Standard type of RSA private key |
66 * Concrete class representing the parameters common to both an RSA public and |
63 * Concrete class representing the parameters common to both an RSA public and |
67 * private key. |
64 * private key. |
68 * |
65 * |
69 * See ANSI X9.31 and RSA PKCS#1 |
66 * See ANSI X9.31 and RSA PKCS#1 |
70 * |
67 * |
71 * @publishedPartner |
|
72 * @released |
|
73 */ |
68 */ |
74 class CRSAParameters : public CBase |
69 class CRSAParameters : public CBase |
75 { |
70 { |
76 public: |
71 public: |
77 /** |
72 /** |
105 * Representation of an RSA public key. |
100 * Representation of an RSA public key. |
106 * |
101 * |
107 * An RSA public key is identified by its modulus (n) and its encryption exponent |
102 * An RSA public key is identified by its modulus (n) and its encryption exponent |
108 * (e). |
103 * (e). |
109 * |
104 * |
110 * @publishedPartner |
|
111 * @released |
|
112 */ |
105 */ |
113 class CRSAPublicKey : public CRSAParameters |
106 class CRSAPublicKey : public CRSAParameters |
114 { |
107 { |
115 public: |
108 public: |
116 /** |
109 /** |
175 * private key. |
168 * private key. |
176 * |
169 * |
177 * To instantiate a representation of an RSA private key, find a |
170 * To instantiate a representation of an RSA private key, find a |
178 * subclass of this appropriate to your key type. |
171 * subclass of this appropriate to your key type. |
179 * |
172 * |
180 * @publishedPartner |
|
181 * @released |
|
182 */ |
173 */ |
183 class CRSAPrivateKey : public CRSAParameters |
174 class CRSAPrivateKey : public CRSAParameters |
184 { |
175 { |
185 public: |
176 public: |
186 /** |
177 /** |
209 /** |
200 /** |
210 * The 'classical' representation of a RSA private key. |
201 * The 'classical' representation of a RSA private key. |
211 * |
202 * |
212 * Such a private key is composed of a modulus (n) and a decryption exponent (d). |
203 * Such a private key is composed of a modulus (n) and a decryption exponent (d). |
213 * |
204 * |
214 * @publishedPartner |
|
215 * @released |
|
216 */ |
205 */ |
217 class CRSAPrivateKeyStandard : public CRSAPrivateKey |
206 class CRSAPrivateKeyStandard : public CRSAPrivateKey |
218 { |
207 { |
219 public: |
208 public: |
220 /** |
209 /** |
278 * Here, a private key is represented by a modulus (n), the two prime factors of |
267 * Here, a private key is represented by a modulus (n), the two prime factors of |
279 * the modulus (p, q), p's CRT exponent (dP), q's CRT exponent (dQ), and the CRT |
268 * the modulus (p, q), p's CRT exponent (dP), q's CRT exponent (dQ), and the CRT |
280 * coefficient (qInv). See PKCS#1 at http://www.rsasecurity.com/rsalabs/pkcs/ |
269 * coefficient (qInv). See PKCS#1 at http://www.rsasecurity.com/rsalabs/pkcs/ |
281 * for more information. |
270 * for more information. |
282 * |
271 * |
283 * @publishedPartner |
|
284 * @released |
|
285 */ |
272 */ |
286 class CRSAPrivateKeyCRT : public CRSAPrivateKey |
273 class CRSAPrivateKeyCRT : public CRSAPrivateKey |
287 { |
274 { |
288 public: |
275 public: |
289 /** |
276 /** |
394 /** |
381 /** |
395 * This class is capable of generating an RSA public/private key pair. |
382 * This class is capable of generating an RSA public/private key pair. |
396 * |
383 * |
397 * By default, it generates 2 prime (standard) CRT private keys. |
384 * By default, it generates 2 prime (standard) CRT private keys. |
398 * |
385 * |
399 * @publishedPartner |
|
400 * @released |
|
401 */ |
386 */ |
402 class CRSAKeyPair : public CBase |
387 class CRSAKeyPair : public CBase |
403 { |
388 { |
404 public: |
389 public: |
405 /** |
390 /** |
466 * Given such a certificate, one can ensure that the DSA |
451 * Given such a certificate, one can ensure that the DSA |
467 * primes contained in CDSAParameters were generated correctly. |
452 * primes contained in CDSAParameters were generated correctly. |
468 * |
453 * |
469 * @see CDSAParameters::ValidatePrimesL() |
454 * @see CDSAParameters::ValidatePrimesL() |
470 * |
455 * |
471 * @publishedPartner |
|
472 * @released |
|
473 */ |
456 */ |
474 class CDSAPrimeCertificate : public CBase |
457 class CDSAPrimeCertificate : public CBase |
475 { |
458 { |
476 public: |
459 public: |
477 /** |
460 /** |
540 * Concrete class representing the parameters common to both a DSA public and |
523 * Concrete class representing the parameters common to both a DSA public and |
541 * private key. |
524 * private key. |
542 * |
525 * |
543 * See FIPS 186-2, Digital Signature Standard |
526 * See FIPS 186-2, Digital Signature Standard |
544 * |
527 * |
545 * @publishedPartner |
|
546 * @released |
|
547 */ |
528 */ |
548 class CDSAParameters : public CBase |
529 class CDSAParameters : public CBase |
549 { |
530 { |
550 public: |
531 public: |
551 /** |
532 /** |
649 }; |
630 }; |
650 |
631 |
651 /** |
632 /** |
652 * Representation of a DSA public key. |
633 * Representation of a DSA public key. |
653 * |
634 * |
654 * @publishedPartner |
|
655 * @released |
|
656 */ |
635 */ |
657 class CDSAPublicKey : public CDSAParameters |
636 class CDSAPublicKey : public CDSAParameters |
658 { |
637 { |
659 public: |
638 public: |
660 /** |
639 /** |
721 }; |
700 }; |
722 |
701 |
723 /** |
702 /** |
724 * Representation of a DSA private key. |
703 * Representation of a DSA private key. |
725 * |
704 * |
726 * @publishedPartner |
|
727 * @released |
|
728 */ |
705 */ |
729 class CDSAPrivateKey : public CDSAParameters |
706 class CDSAPrivateKey : public CDSAParameters |
730 { |
707 { |
731 public: |
708 public: |
732 /** |
709 /** |
793 }; |
770 }; |
794 |
771 |
795 /** |
772 /** |
796 * This class is capable of generating a DSA public/private key pair. |
773 * This class is capable of generating a DSA public/private key pair. |
797 * |
774 * |
798 * @publishedPartner |
|
799 * @released |
|
800 */ |
775 */ |
801 class CDSAKeyPair : public CBase |
776 class CDSAKeyPair : public CBase |
802 { |
777 { |
803 public: |
778 public: |
804 /** |
779 /** |
860 |
835 |
861 /** |
836 /** |
862 * Concrete class representing the parameters common to both |
837 * Concrete class representing the parameters common to both |
863 * a Diffie-Hellman (DH) public and private key. |
838 * a Diffie-Hellman (DH) public and private key. |
864 * |
839 * |
865 * @publishedPartner |
|
866 * @released |
|
867 */ |
840 */ |
868 class CDHParameters : public CBase |
841 class CDHParameters : public CBase |
869 { |
842 { |
870 public: |
843 public: |
871 /** |
844 /** |
914 }; |
887 }; |
915 |
888 |
916 /** |
889 /** |
917 * Representation of a Diffie-Hellman (DH) public key. |
890 * Representation of a Diffie-Hellman (DH) public key. |
918 * |
891 * |
919 * @publishedPartner |
|
920 * @released |
|
921 */ |
892 */ |
922 class CDHPublicKey : public CDHParameters |
893 class CDHPublicKey : public CDHParameters |
923 { |
894 { |
924 public: |
895 public: |
925 /** |
896 /** |
982 }; |
953 }; |
983 |
954 |
984 /** |
955 /** |
985 * Representation of a Diffie-Hellman (DH) private key. |
956 * Representation of a Diffie-Hellman (DH) private key. |
986 * |
957 * |
987 * @publishedPartner |
|
988 * @released |
|
989 */ |
958 */ |
990 class CDHPrivateKey : public CDHParameters |
959 class CDHPrivateKey : public CDHParameters |
991 { |
960 { |
992 public: |
961 public: |
993 /** |
962 /** |
1050 }; |
1019 }; |
1051 |
1020 |
1052 /** |
1021 /** |
1053 * This class is capable of generating a Diffie-Hellman (DH) public/private key pair. |
1022 * This class is capable of generating a Diffie-Hellman (DH) public/private key pair. |
1054 * |
1023 * |
1055 * @publishedPartner |
|
1056 * @released |
|
1057 */ |
1024 */ |
1058 class CDHKeyPair : public CBase |
1025 class CDHKeyPair : public CBase |
1059 { |
1026 { |
1060 public: |
1027 public: |
1061 /** |
1028 /** |