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