lowkeyi.h (2308B)
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 extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); 29 extern void prepare_low_ecparams_for_asn1(ECParams *params); 30 extern void prepare_low_rsa_pub_key_for_asn1(NSSLOWKEYPublicKey *key); 31 32 /* 33 ** Destroy a private key object. 34 ** "key" the object 35 ** "freeit" if PR_TRUE then free the object as well as its sub-objects 36 */ 37 extern void nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *key); 38 39 /* 40 ** Destroy a public key object. 41 ** "key" the object 42 ** "freeit" if PR_TRUE then free the object as well as its sub-objects 43 */ 44 extern void nsslowkey_DestroyPublicKey(NSSLOWKEYPublicKey *key); 45 46 /* 47 ** Return the modulus length of "pubKey". 48 */ 49 extern unsigned int nsslowkey_PublicModulusLen(NSSLOWKEYPublicKey *pubKey); 50 51 /* 52 ** Return the modulus length of "privKey". 53 */ 54 extern unsigned int nsslowkey_PrivateModulusLen(NSSLOWKEYPrivateKey *privKey); 55 56 /* 57 ** Convert a low private key "privateKey" into a public low key 58 */ 59 extern NSSLOWKEYPublicKey * 60 nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privateKey); 61 62 /* Make a copy of a low private key in it's own arena. 63 * a return of NULL indicates an error. 64 */ 65 extern NSSLOWKEYPrivateKey * 66 nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey); 67 68 SEC_END_PROTOS 69 70 #endif /* _LOWKEYI_H_ */