2016-05-18 02:51:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
1998-12-21 18:52:47 +08:00
|
|
|
*
|
2018-12-06 20:17:34 +08:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 02:51:34 +08:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
1998-12-21 18:52:47 +08:00
|
|
|
*/
|
|
|
|
|
2016-02-01 02:08:23 +08:00
|
|
|
#include "openssl/opensslconf.h"
|
|
|
|
#ifdef OPENSSL_NO_RSA
|
|
|
|
NON_EMPTY_TRANSLATION_UNIT
|
|
|
|
#else
|
|
|
|
|
|
|
|
# include "internal/cryptlib.h"
|
|
|
|
# include <stdio.h>
|
2015-01-22 11:40:55 +08:00
|
|
|
# include <openssl/rsa.h>
|
|
|
|
# include <openssl/objects.h>
|
|
|
|
# include <openssl/asn1t.h>
|
|
|
|
# include <openssl/evp.h>
|
|
|
|
# include <openssl/x509.h>
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_RC4
|
|
|
|
|
2019-02-22 02:23:06 +08:00
|
|
|
# define ASN1_BROKEN_SEQUENCE(tname) \
|
|
|
|
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
|
|
|
|
ASN1_SEQUENCE(tname)
|
|
|
|
# define static_ASN1_BROKEN_SEQUENCE_END(stname) \
|
|
|
|
static_ASN1_SEQUENCE_END_ref(stname, stname)
|
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
typedef struct netscape_pkey_st {
|
2017-04-05 19:24:14 +08:00
|
|
|
int32_t version;
|
2015-01-22 11:40:55 +08:00
|
|
|
X509_ALGOR *algor;
|
|
|
|
ASN1_OCTET_STRING *private_key;
|
|
|
|
} NETSCAPE_PKEY;
|
|
|
|
|
|
|
|
typedef struct netscape_encrypted_pkey_st {
|
|
|
|
ASN1_OCTET_STRING *os;
|
|
|
|
/*
|
|
|
|
* This is the same structure as DigestInfo so use it: although this
|
|
|
|
* isn't really anything to do with digests.
|
|
|
|
*/
|
|
|
|
X509_SIG *enckey;
|
|
|
|
} NETSCAPE_ENCRYPTED_PKEY;
|
2000-12-09 03:09:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = {
|
2015-01-22 11:40:55 +08:00
|
|
|
ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, os, ASN1_OCTET_STRING),
|
|
|
|
ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG)
|
2015-09-05 20:32:58 +08:00
|
|
|
} static_ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
|
2000-12-09 03:09:35 +08:00
|
|
|
|
2019-01-16 04:51:25 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(NETSCAPE_ENCRYPTED_PKEY)
|
|
|
|
DECLARE_ASN1_ENCODE_FUNCTIONS_name(NETSCAPE_ENCRYPTED_PKEY, NETSCAPE_ENCRYPTED_PKEY)
|
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_ENCRYPTED_PKEY)
|
2000-12-09 03:09:35 +08:00
|
|
|
|
|
|
|
ASN1_SEQUENCE(NETSCAPE_PKEY) = {
|
2017-04-12 17:52:52 +08:00
|
|
|
ASN1_EMBED(NETSCAPE_PKEY, version, INT32),
|
2015-01-22 11:40:55 +08:00
|
|
|
ASN1_SIMPLE(NETSCAPE_PKEY, algor, X509_ALGOR),
|
|
|
|
ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING)
|
2015-09-05 20:32:58 +08:00
|
|
|
} static_ASN1_SEQUENCE_END(NETSCAPE_PKEY)
|
2000-12-09 03:09:35 +08:00
|
|
|
|
2019-01-16 04:51:25 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(NETSCAPE_PKEY)
|
|
|
|
DECLARE_ASN1_ENCODE_FUNCTIONS_name(NETSCAPE_PKEY, NETSCAPE_PKEY)
|
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_PKEY)
|
2000-12-09 03:09:35 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# endif /* OPENSSL_NO_RC4 */
|
|
|
|
|
1999-04-27 09:14:46 +08:00
|
|
|
#endif
|