1 | /** @file
|
---|
2 | * IPRT - PKCS \#8, Private-Key Information Syntax Standard.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_crypto_pkcs8_h
|
---|
37 | #define IPRT_INCLUDED_crypto_pkcs8_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <iprt/asn1.h>
|
---|
43 | #include <iprt/crypto/x509.h>
|
---|
44 | #include <iprt/crypto/pkcs7.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | RT_C_DECLS_BEGIN
|
---|
48 |
|
---|
49 | /** @defgroup grp_rt_crpkcs8 RTCrPkcs8 - PKCS \#8, Private-Key Information Syntax Standard
|
---|
50 | *
|
---|
51 | * See RFC-5208 for details.
|
---|
52 | *
|
---|
53 | * @ingroup grp_rt_crypto
|
---|
54 | * @{
|
---|
55 | */
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * PKCS\#8 PrivateKeyInfo.
|
---|
59 | *
|
---|
60 | * See RFC-5208 section 5.
|
---|
61 | */
|
---|
62 | typedef struct RTCRPKCS8PRIVATEKEYINFO
|
---|
63 | {
|
---|
64 | /** Sequence core for the structure. */
|
---|
65 | RTASN1SEQUENCECORE SeqCore;
|
---|
66 | /** Key version number. */
|
---|
67 | RTASN1INTEGER Version;
|
---|
68 | /** The private key algorithm. */
|
---|
69 | RTCRX509ALGORITHMIDENTIFIER PrivateKeyAlgorithm;
|
---|
70 | /** The private key, according to PrivateKeyAlgorithm.
|
---|
71 | * For RSA there is RSAPrivateKey (in BER encoding) embedded in this string. */
|
---|
72 | RTASN1OCTETSTRING PrivateKey;
|
---|
73 | /** Attributes, optional [0].
|
---|
74 | * @todo check this one. */
|
---|
75 | RTCRPKCS7ATTRIBUTES Attributes;
|
---|
76 | } RTCRPKCS8PRIVATEKEYINFO;
|
---|
77 | /** Pointer to the ASN.1 IPRT representation of a PKCS8 private key. */
|
---|
78 | typedef RTCRPKCS8PRIVATEKEYINFO *PRTCRPKCS8PRIVATEKEYINFO;
|
---|
79 | /** Pointer to the const ASN.1 IPRT representation of a PKCS8 private key. */
|
---|
80 | typedef RTCRPKCS8PRIVATEKEYINFO const *PCRTCRPKCS8PRIVATEKEYINFO;
|
---|
81 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRPKCS8PRIVATEKEYINFO, RTDECL, RTCrPkcs8PrivateKeyInfo, SeqCore.Asn1Core);
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * PKCS\#8 EncryptedPrivateKeyInfo.
|
---|
85 | *
|
---|
86 | * See RFC-5208 section 6.
|
---|
87 | */
|
---|
88 | typedef struct RTCRPKCS8ENCRYPTEDPRIVATEKEYINFO
|
---|
89 | {
|
---|
90 | /** Sequence core for the structure. */
|
---|
91 | RTASN1SEQUENCECORE SeqCore;
|
---|
92 | /** The encryption algorithm. */
|
---|
93 | RTCRX509ALGORITHMIDENTIFIER EncryptionAlgorithm;
|
---|
94 | /** The encrypted data. */
|
---|
95 | RTASN1OCTETSTRING EncryptedData;
|
---|
96 | } RTCRPKCS8ENCRYPTEDPRIVATEKEYINFO;
|
---|
97 | /** Pointer to the ASN.1 IPRT representation of a PKCS8 encrypted private
|
---|
98 | * key info. */
|
---|
99 | typedef RTCRPKCS8ENCRYPTEDPRIVATEKEYINFO *PRTCRPKCS8ENCRYPTEDPRIVATEKEYINFO;
|
---|
100 | /** Pointer to the const ASN.1 IPRT representation of a PKCS8 encrypted
|
---|
101 | * private key info. */
|
---|
102 | typedef RTCRPKCS8ENCRYPTEDPRIVATEKEYINFO const *PCRTCRPKCS8ENCRYPTEDPRIVATEKEYINFO;
|
---|
103 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRPKCS8ENCRYPTEDPRIVATEKEYINFO, RTDECL, RTCrPkcs8EncryptedPrivateKeyInfo, SeqCore.Asn1Core);
|
---|
104 |
|
---|
105 | /** @} */
|
---|
106 |
|
---|
107 | RT_C_DECLS_END
|
---|
108 |
|
---|
109 | #endif /* !IPRT_INCLUDED_crypto_pkcs8_h */
|
---|