]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/asn1/n_pkey.c
Update copyright year
[thirdparty/openssl.git] / crypto / asn1 / n_pkey.c
CommitLineData
2039c421 1/*
33388b44 2 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
365a2d99 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
2039c421
RS
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
d02b48c6
RE
8 */
9
effaf4de 10#include "openssl/opensslconf.h"
effaf4de 11
705536e2
RS
12#include "internal/cryptlib.h"
13#include <stdio.h>
14#include <openssl/rsa.h>
15#include <openssl/objects.h>
16#include <openssl/asn1t.h>
17#include <openssl/evp.h>
18#include <openssl/x509.h>
0f113f3e 19
705536e2 20#define ASN1_BROKEN_SEQUENCE(tname) \
6098b69e
RS
21 static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
22 ASN1_SEQUENCE(tname)
705536e2 23#define static_ASN1_BROKEN_SEQUENCE_END(stname) \
6098b69e
RS
24 static_ASN1_SEQUENCE_END_ref(stname, stname)
25
0f113f3e 26typedef struct netscape_pkey_st {
6a32a3c0 27 int32_t version;
0f113f3e
MC
28 X509_ALGOR *algor;
29 ASN1_OCTET_STRING *private_key;
30} NETSCAPE_PKEY;
31
32typedef struct netscape_encrypted_pkey_st {
33 ASN1_OCTET_STRING *os;
34 /*
35 * This is the same structure as DigestInfo so use it: although this
36 * isn't really anything to do with digests.
37 */
38 X509_SIG *enckey;
39} NETSCAPE_ENCRYPTED_PKEY;
9d6b1ce6
DSH
40
41
42ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = {
0f113f3e
MC
43 ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, os, ASN1_OCTET_STRING),
44 ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG)
df2ee0e2 45} static_ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
9d6b1ce6 46
9fdcc21f
DO
47DECLARE_ASN1_FUNCTIONS(NETSCAPE_ENCRYPTED_PKEY)
48DECLARE_ASN1_ENCODE_FUNCTIONS_name(NETSCAPE_ENCRYPTED_PKEY, NETSCAPE_ENCRYPTED_PKEY)
49IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_ENCRYPTED_PKEY)
9d6b1ce6
DSH
50
51ASN1_SEQUENCE(NETSCAPE_PKEY) = {
9612e157 52 ASN1_EMBED(NETSCAPE_PKEY, version, INT32),
0f113f3e
MC
53 ASN1_SIMPLE(NETSCAPE_PKEY, algor, X509_ALGOR),
54 ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING)
df2ee0e2 55} static_ASN1_SEQUENCE_END(NETSCAPE_PKEY)
9d6b1ce6 56
9fdcc21f
DO
57DECLARE_ASN1_FUNCTIONS(NETSCAPE_PKEY)
58DECLARE_ASN1_ENCODE_FUNCTIONS_name(NETSCAPE_PKEY, NETSCAPE_PKEY)
59IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_PKEY)