1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/softoken/lowkeyi.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef _LOWKEYI_H_ 1.9 +#define _LOWKEYI_H_ 1.10 + 1.11 +#include "prtypes.h" 1.12 +#include "seccomon.h" 1.13 +#include "secoidt.h" 1.14 +#include "lowkeyti.h" 1.15 + 1.16 +SEC_BEGIN_PROTOS 1.17 + 1.18 +/* 1.19 + * See bugzilla bug 125359 1.20 + * Since NSS (via PKCS#11) wants to handle big integers as unsigned ints, 1.21 + * all of the templates above that en/decode into integers must be converted 1.22 + * from ASN.1's signed integer type. This is done by marking either the 1.23 + * source or destination (encoding or decoding, respectively) type as 1.24 + * siUnsignedInteger. 1.25 + */ 1.26 +extern void prepare_low_rsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); 1.27 +extern void prepare_low_pqg_params_for_asn1(PQGParams *params); 1.28 +extern void prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); 1.29 +extern void prepare_low_dsa_priv_key_export_for_asn1(NSSLOWKEYPrivateKey *key); 1.30 +extern void prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); 1.31 +#ifndef NSS_DISABLE_ECC 1.32 +extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key); 1.33 +extern void prepare_low_ecparams_for_asn1(ECParams *params); 1.34 +#endif /* NSS_DISABLE_ECC */ 1.35 + 1.36 +/* 1.37 +** Destroy a private key object. 1.38 +** "key" the object 1.39 +** "freeit" if PR_TRUE then free the object as well as its sub-objects 1.40 +*/ 1.41 +extern void nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *key); 1.42 + 1.43 +/* 1.44 +** Destroy a public key object. 1.45 +** "key" the object 1.46 +** "freeit" if PR_TRUE then free the object as well as its sub-objects 1.47 +*/ 1.48 +extern void nsslowkey_DestroyPublicKey(NSSLOWKEYPublicKey *key); 1.49 + 1.50 +/* 1.51 +** Return the modulus length of "pubKey". 1.52 +*/ 1.53 +extern unsigned int nsslowkey_PublicModulusLen(NSSLOWKEYPublicKey *pubKey); 1.54 + 1.55 + 1.56 +/* 1.57 +** Return the modulus length of "privKey". 1.58 +*/ 1.59 +extern unsigned int nsslowkey_PrivateModulusLen(NSSLOWKEYPrivateKey *privKey); 1.60 + 1.61 + 1.62 +/* 1.63 +** Convert a low private key "privateKey" into a public low key 1.64 +*/ 1.65 +extern NSSLOWKEYPublicKey 1.66 + *nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privateKey); 1.67 + 1.68 +/* Make a copy of a low private key in it's own arena. 1.69 + * a return of NULL indicates an error. 1.70 + */ 1.71 +extern NSSLOWKEYPrivateKey * 1.72 +nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey); 1.73 + 1.74 + 1.75 +SEC_END_PROTOS 1.76 + 1.77 +#endif /* _LOWKEYI_H_ */