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