n_pkey.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include "openssl/opensslconf.h"
  10. #ifdef OPENSSL_NO_RSA
  11. NON_EMPTY_TRANSLATION_UNIT
  12. #else
  13. # include "internal/cryptlib.h"
  14. # include <stdio.h>
  15. # include <openssl/rsa.h>
  16. # include <openssl/objects.h>
  17. # include <openssl/asn1t.h>
  18. # include <openssl/evp.h>
  19. # include <openssl/x509.h>
  20. # ifndef OPENSSL_NO_RC4
  21. typedef struct netscape_pkey_st {
  22. int32_t version;
  23. X509_ALGOR *algor;
  24. ASN1_OCTET_STRING *private_key;
  25. } NETSCAPE_PKEY;
  26. typedef struct netscape_encrypted_pkey_st {
  27. ASN1_OCTET_STRING *os;
  28. /*
  29. * This is the same structure as DigestInfo so use it: although this
  30. * isn't really anything to do with digests.
  31. */
  32. X509_SIG *enckey;
  33. } NETSCAPE_ENCRYPTED_PKEY;
  34. ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = {
  35. ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, os, ASN1_OCTET_STRING),
  36. ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG)
  37. } static_ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
  38. DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
  39. DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY,NETSCAPE_ENCRYPTED_PKEY)
  40. IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
  41. ASN1_SEQUENCE(NETSCAPE_PKEY) = {
  42. ASN1_EMBED(NETSCAPE_PKEY, version, INT32),
  43. ASN1_SIMPLE(NETSCAPE_PKEY, algor, X509_ALGOR),
  44. ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING)
  45. } static_ASN1_SEQUENCE_END(NETSCAPE_PKEY)
  46. DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
  47. DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY)
  48. IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
  49. # endif /* OPENSSL_NO_RC4 */
  50. #endif