|
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 |
|
5 #ifndef _LOWKEYI_H_ |
|
6 #define _LOWKEYI_H_ |
|
7 |
|
8 #include "prtypes.h" |
|
9 #include "seccomon.h" |
|
10 #include "secoidt.h" |
|
11 #include "lowkeyti.h" |
|
12 |
|
13 SEC_BEGIN_PROTOS |
|
14 |
|
15 /* |
|
16 * See bugzilla bug 125359 |
|
17 * Since NSS (via PKCS#11) wants to handle big integers as unsigned ints, |
|
18 * all of the templates above that en/decode into integers must be converted |
|
19 * from ASN.1's signed integer type. This is done by marking either the |
|
20 * source or destination (encoding or decoding, respectively) type as |
|
21 * siUnsignedInteger. |
|
22 */ |
|
23 extern void prepare_low_rsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); |
|
24 extern void prepare_low_pqg_params_for_asn1(PQGParams *params); |
|
25 extern void prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); |
|
26 extern void prepare_low_dsa_priv_key_export_for_asn1(NSSLOWKEYPrivateKey *key); |
|
27 extern void prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); |
|
28 #ifndef NSS_DISABLE_ECC |
|
29 extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); |
|
30 extern void prepare_low_ecparams_for_asn1(ECParams *params); |
|
31 #endif /* NSS_DISABLE_ECC */ |
|
32 |
|
33 /* |
|
34 ** Destroy a private key object. |
|
35 ** "key" the object |
|
36 ** "freeit" if PR_TRUE then free the object as well as its sub-objects |
|
37 */ |
|
38 extern void nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *key); |
|
39 |
|
40 /* |
|
41 ** Destroy a public key object. |
|
42 ** "key" the object |
|
43 ** "freeit" if PR_TRUE then free the object as well as its sub-objects |
|
44 */ |
|
45 extern void nsslowkey_DestroyPublicKey(NSSLOWKEYPublicKey *key); |
|
46 |
|
47 /* |
|
48 ** Return the modulus length of "pubKey". |
|
49 */ |
|
50 extern unsigned int nsslowkey_PublicModulusLen(NSSLOWKEYPublicKey *pubKey); |
|
51 |
|
52 |
|
53 /* |
|
54 ** Return the modulus length of "privKey". |
|
55 */ |
|
56 extern unsigned int nsslowkey_PrivateModulusLen(NSSLOWKEYPrivateKey *privKey); |
|
57 |
|
58 |
|
59 /* |
|
60 ** Convert a low private key "privateKey" into a public low key |
|
61 */ |
|
62 extern NSSLOWKEYPublicKey |
|
63 *nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privateKey); |
|
64 |
|
65 /* Make a copy of a low private key in it's own arena. |
|
66 * a return of NULL indicates an error. |
|
67 */ |
|
68 extern NSSLOWKEYPrivateKey * |
|
69 nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey); |
|
70 |
|
71 |
|
72 SEC_END_PROTOS |
|
73 |
|
74 #endif /* _LOWKEYI_H_ */ |