OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 #ifndef _LOWKEYTI_H_ | 4 #ifndef _LOWKEYTI_H_ |
5 #define _LOWKEYTI_H_ 1 | 5 #define _LOWKEYTI_H_ 1 |
6 | 6 |
7 #include "blapit.h" | 7 #include "blapit.h" |
8 #include "prtypes.h" | 8 #include "prtypes.h" |
9 #include "plarena.h" | 9 #include "plarena.h" |
10 #include "secitem.h" | 10 #include "secitem.h" |
11 #include "secasn1t.h" | 11 #include "secasn1t.h" |
12 #include "secoidt.h" | 12 #include "secoidt.h" |
13 | 13 |
14 /* | 14 /* |
15 ** Typedef for callback to get a password "key". | 15 ** Typedef for callback to get a password "key". |
16 */ | 16 */ |
17 extern const SEC_ASN1Template nsslowkey_PQGParamsTemplate[]; | 17 extern const SEC_ASN1Template nsslowkey_PQGParamsTemplate[]; |
18 extern const SEC_ASN1Template nsslowkey_RSAPrivateKeyTemplate[]; | 18 extern const SEC_ASN1Template nsslowkey_RSAPrivateKeyTemplate[]; |
19 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[]; | 19 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[]; |
20 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[]; | 20 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[]; |
21 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[]; | 21 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[]; |
22 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[]; | 22 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[]; |
23 #ifndef NSS_DISABLE_ECC | 23 #ifndef NSS_DISABLE_ECC |
24 #define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */ | 24 #define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */ |
25 extern const SEC_ASN1Template nsslowkey_ECParamsTemplate[]; | 25 extern const SEC_ASN1Template nsslowkey_ECParamsTemplate[]; |
26 extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[]; | 26 extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[]; |
27 #endif /* NSS_DISABLE_ECC */ | 27 #endif /* NSS_DISABLE_ECC */ |
28 | 28 |
29 extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[]; | 29 extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[]; |
30 extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[]; | 30 extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[]; |
31 | 31 |
32 /* | 32 /* |
33 * PKCS #8 attributes | 33 * PKCS #8 attributes |
34 */ | 34 */ |
35 struct NSSLOWKEYAttributeStr { | 35 struct NSSLOWKEYAttributeStr { |
36 SECItem attrType; | 36 SECItem attrType; |
37 SECItem *attrValue; | 37 SECItem *attrValue; |
38 }; | 38 }; |
39 typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute; | 39 typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute; |
40 | 40 |
41 /* | 41 /* |
42 ** A PKCS#8 private key info object | 42 ** A PKCS#8 private key info object |
43 */ | 43 */ |
44 struct NSSLOWKEYPrivateKeyInfoStr { | 44 struct NSSLOWKEYPrivateKeyInfoStr { |
45 PLArenaPool *arena; | 45 PLArenaPool *arena; |
46 SECItem version; | 46 SECItem version; |
47 SECAlgorithmID algorithm; | 47 SECAlgorithmID algorithm; |
48 SECItem privateKey; | 48 SECItem privateKey; |
49 NSSLOWKEYAttribute **attributes; | 49 NSSLOWKEYAttribute **attributes; |
50 }; | 50 }; |
51 typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo; | 51 typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo; |
52 #define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION» 0» /* what we *create* */ | 52 #define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION 0 /* what we *create* */ |
53 | 53 |
54 typedef enum { | 54 typedef enum { |
55 NSSLOWKEYNullKey = 0, | 55 NSSLOWKEYNullKey = 0, |
56 NSSLOWKEYRSAKey = 1, | 56 NSSLOWKEYRSAKey = 1, |
57 NSSLOWKEYDSAKey = 2, | 57 NSSLOWKEYDSAKey = 2, |
58 NSSLOWKEYDHKey = 4, | 58 NSSLOWKEYDHKey = 4, |
59 NSSLOWKEYECKey = 5 | 59 NSSLOWKEYECKey = 5 |
60 } NSSLOWKEYType; | 60 } NSSLOWKEYType; |
61 | 61 |
62 /* | 62 /* |
63 ** An RSA public key object. | 63 ** An RSA public key object. |
64 */ | 64 */ |
65 struct NSSLOWKEYPublicKeyStr { | 65 struct NSSLOWKEYPublicKeyStr { |
66 PLArenaPool *arena; | 66 PLArenaPool *arena; |
67 NSSLOWKEYType keyType ; | 67 NSSLOWKEYType keyType; |
68 union { | 68 union { |
69 RSAPublicKey rsa; | 69 RSAPublicKey rsa; |
70 » DSAPublicKey dsa; | 70 DSAPublicKey dsa; |
71 » DHPublicKey dh; | 71 DHPublicKey dh; |
72 » ECPublicKey ec; | 72 ECPublicKey ec; |
73 } u; | 73 } u; |
74 }; | 74 }; |
75 typedef struct NSSLOWKEYPublicKeyStr NSSLOWKEYPublicKey; | 75 typedef struct NSSLOWKEYPublicKeyStr NSSLOWKEYPublicKey; |
76 | 76 |
77 /* | 77 /* |
78 ** Low Level private key object | 78 ** Low Level private key object |
79 ** This is only used by the raw Crypto engines (crypto), keydb (keydb), | 79 ** This is only used by the raw Crypto engines (crypto), keydb (keydb), |
80 ** and PKCS #11. Everyone else uses the high level key structure. | 80 ** and PKCS #11. Everyone else uses the high level key structure. |
81 */ | 81 */ |
82 struct NSSLOWKEYPrivateKeyStr { | 82 struct NSSLOWKEYPrivateKeyStr { |
83 PLArenaPool *arena; | 83 PLArenaPool *arena; |
84 NSSLOWKEYType keyType; | 84 NSSLOWKEYType keyType; |
85 union { | 85 union { |
86 RSAPrivateKey rsa; | 86 RSAPrivateKey rsa; |
87 » DSAPrivateKey dsa; | 87 DSAPrivateKey dsa; |
88 » DHPrivateKey dh; | 88 DHPrivateKey dh; |
89 » ECPrivateKey ec; | 89 ECPrivateKey ec; |
90 } u; | 90 } u; |
91 }; | 91 }; |
92 typedef struct NSSLOWKEYPrivateKeyStr NSSLOWKEYPrivateKey; | 92 typedef struct NSSLOWKEYPrivateKeyStr NSSLOWKEYPrivateKey; |
93 | 93 |
94 #endif» /* _LOWKEYTI_H_ */ | 94 #endif /* _LOWKEYTI_H_ */ |
OLD | NEW |