michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _LOWKEYI_H_ michael@0: #define _LOWKEYI_H_ michael@0: michael@0: #include "prtypes.h" michael@0: #include "seccomon.h" michael@0: #include "secoidt.h" michael@0: #include "lowkeyti.h" michael@0: michael@0: SEC_BEGIN_PROTOS michael@0: michael@0: /* michael@0: * See bugzilla bug 125359 michael@0: * Since NSS (via PKCS#11) wants to handle big integers as unsigned ints, michael@0: * all of the templates above that en/decode into integers must be converted michael@0: * from ASN.1's signed integer type. This is done by marking either the michael@0: * source or destination (encoding or decoding, respectively) type as michael@0: * siUnsignedInteger. michael@0: */ michael@0: extern void prepare_low_rsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); michael@0: extern void prepare_low_pqg_params_for_asn1(PQGParams *params); michael@0: extern void prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); michael@0: extern void prepare_low_dsa_priv_key_export_for_asn1(NSSLOWKEYPrivateKey *key); michael@0: extern void prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); michael@0: #ifndef NSS_DISABLE_ECC michael@0: extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); michael@0: extern void prepare_low_ecparams_for_asn1(ECParams *params); michael@0: #endif /* NSS_DISABLE_ECC */ michael@0: michael@0: /* michael@0: ** Destroy a private key object. michael@0: ** "key" the object michael@0: ** "freeit" if PR_TRUE then free the object as well as its sub-objects michael@0: */ michael@0: extern void nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *key); michael@0: michael@0: /* michael@0: ** Destroy a public key object. michael@0: ** "key" the object michael@0: ** "freeit" if PR_TRUE then free the object as well as its sub-objects michael@0: */ michael@0: extern void nsslowkey_DestroyPublicKey(NSSLOWKEYPublicKey *key); michael@0: michael@0: /* michael@0: ** Return the modulus length of "pubKey". michael@0: */ michael@0: extern unsigned int nsslowkey_PublicModulusLen(NSSLOWKEYPublicKey *pubKey); michael@0: michael@0: michael@0: /* michael@0: ** Return the modulus length of "privKey". michael@0: */ michael@0: extern unsigned int nsslowkey_PrivateModulusLen(NSSLOWKEYPrivateKey *privKey); michael@0: michael@0: michael@0: /* michael@0: ** Convert a low private key "privateKey" into a public low key michael@0: */ michael@0: extern NSSLOWKEYPublicKey michael@0: *nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privateKey); michael@0: michael@0: /* Make a copy of a low private key in it's own arena. michael@0: * a return of NULL indicates an error. michael@0: */ michael@0: extern NSSLOWKEYPrivateKey * michael@0: nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey); michael@0: michael@0: michael@0: SEC_END_PROTOS michael@0: michael@0: #endif /* _LOWKEYI_H_ */