/security/nss/lib/softoken/lowkeyi.h

http://github.com/zpao/v8monkey · C Header · 108 lines · 26 code · 15 blank · 67 comment · 0 complexity · bab4870b8d2bf28d4491fe496d5570a5 MD5 · raw file

  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is the Netscape security libraries.
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Netscape Communications Corporation.
  18. * Portions created by the Initial Developer are Copyright (C) 1994-2000
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /* $Id: lowkeyi.h,v 1.11 2007/06/13 00:24:56 rrelyea%redhat.com Exp $ */
  38. #ifndef _LOWKEYI_H_
  39. #define _LOWKEYI_H_
  40. #include "prtypes.h"
  41. #include "seccomon.h"
  42. #include "secoidt.h"
  43. #include "lowkeyti.h"
  44. SEC_BEGIN_PROTOS
  45. /*
  46. * See bugzilla bug 125359
  47. * Since NSS (via PKCS#11) wants to handle big integers as unsigned ints,
  48. * all of the templates above that en/decode into integers must be converted
  49. * from ASN.1's signed integer type. This is done by marking either the
  50. * source or destination (encoding or decoding, respectively) type as
  51. * siUnsignedInteger.
  52. */
  53. extern void prepare_low_rsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
  54. extern void prepare_low_pqg_params_for_asn1(PQGParams *params);
  55. extern void prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
  56. extern void prepare_low_dsa_priv_key_export_for_asn1(NSSLOWKEYPrivateKey *key);
  57. extern void prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
  58. #ifdef NSS_ENABLE_ECC
  59. extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
  60. extern void prepare_low_ecparams_for_asn1(ECParams *params);
  61. #endif /* NSS_ENABLE_ECC */
  62. /*
  63. ** Destroy a private key object.
  64. ** "key" the object
  65. ** "freeit" if PR_TRUE then free the object as well as its sub-objects
  66. */
  67. extern void nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *key);
  68. /*
  69. ** Destroy a public key object.
  70. ** "key" the object
  71. ** "freeit" if PR_TRUE then free the object as well as its sub-objects
  72. */
  73. extern void nsslowkey_DestroyPublicKey(NSSLOWKEYPublicKey *key);
  74. /*
  75. ** Return the modulus length of "pubKey".
  76. */
  77. extern unsigned int nsslowkey_PublicModulusLen(NSSLOWKEYPublicKey *pubKey);
  78. /*
  79. ** Return the modulus length of "privKey".
  80. */
  81. extern unsigned int nsslowkey_PrivateModulusLen(NSSLOWKEYPrivateKey *privKey);
  82. /*
  83. ** Convert a low private key "privateKey" into a public low key
  84. */
  85. extern NSSLOWKEYPublicKey
  86. *nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privateKey);
  87. /* Make a copy of a low private key in it's own arena.
  88. * a return of NULL indicates an error.
  89. */
  90. extern NSSLOWKEYPrivateKey *
  91. nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey);
  92. SEC_END_PROTOS
  93. #endif /* _LOWKEYI_H_ */