1 | /* $Id: taf-template.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Crypto - Trust Anchor Format (RFC-5914), Code Generator Template.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #define RTASN1TMPL_DECL RTDECL
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * CertPathControls (not sequence-/set-of).
|
---|
41 | */
|
---|
42 | #define RTASN1TMPL_TYPE RTCRTAFCERTPATHCONTROLS
|
---|
43 | #define RTASN1TMPL_EXT_NAME RTCrTafCertPathControls
|
---|
44 | #define RTASN1TMPL_INT_NAME rtCrTafCertPathControls
|
---|
45 | RTASN1TMPL_BEGIN_SEQCORE();
|
---|
46 | RTASN1TMPL_MEMBER( TaName, RTCRX509NAME, RTCrX509Name);
|
---|
47 | RTASN1TMPL_MEMBER_OPT_ITAG( Certificate, RTCRX509CERTIFICATE, RTCrX509Certificate, 0);
|
---|
48 | RTASN1TMPL_MEMBER_OPT_ITAG( PolicySet, RTCRX509CERTIFICATEPOLICIES, RTCrX509CertificatePolicies, 1);
|
---|
49 | RTASN1TMPL_MEMBER_OPT_ITAG_BITSTRING(PolicyFlags, 3 /* max bits */, 2);
|
---|
50 | RTASN1TMPL_MEMBER_OPT_ITAG( NameConstr, RTCRX509NAMECONSTRAINTS, RTCrX509NameConstraints, 3);
|
---|
51 | RTASN1TMPL_MEMBER_OPT_ITAG_EX( PathLenConstraint, RTASN1INTEGER, RTAsn1Integer, 4, RTASN1TMPL_ITAG_F_CP, RT_NOTHING);
|
---|
52 | RTASN1TMPL_END_SEQCORE();
|
---|
53 | #undef RTASN1TMPL_TYPE
|
---|
54 | #undef RTASN1TMPL_EXT_NAME
|
---|
55 | #undef RTASN1TMPL_INT_NAME
|
---|
56 |
|
---|
57 |
|
---|
58 | /*
|
---|
59 | * TrustAnchorInfo.
|
---|
60 | */
|
---|
61 | #define RTASN1TMPL_TYPE RTCRTAFTRUSTANCHORINFO
|
---|
62 | #define RTASN1TMPL_EXT_NAME RTCrTafTrustAnchorInfo
|
---|
63 | #define RTASN1TMPL_INT_NAME rtCrTafTrustAnchorInfo
|
---|
64 | RTASN1TMPL_BEGIN_SEQCORE();
|
---|
65 | RTASN1TMPL_MEMBER_DEF_ITAG_UP( Version, RTASN1INTEGER, RTAsn1Integer, ASN1_TAG_INTEGER, RTCRTAFTRUSTANCHORINFO_V1);
|
---|
66 | RTASN1TMPL_MEMBER( PubKey, RTCRX509SUBJECTPUBLICKEYINFO, RTCrX509SubjectPublicKeyInfo);
|
---|
67 | RTASN1TMPL_MEMBER( KeyIdentifier, RTASN1OCTETSTRING, RTAsn1OctetString);
|
---|
68 | RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(TaTitle, RTASN1TMPL_MEMBER_CONSTR_MIN_MAX(TaTitleLangTag, RTASN1STRING, RTAsn1String, 1, 64, RT_NOTHING));
|
---|
69 | RTASN1TMPL_MEMBER_OPT_ITAG_EX( CertPath, RTCRTAFCERTPATHCONTROLS, RTCrTafCertPathControls, ASN1_TAG_SEQUENCE, RTASN1TMPL_ITAG_F_UC, RT_NOTHING);
|
---|
70 | RTASN1TMPL_MEMBER_OPT_XTAG( T1, CtxTag1, Exts, RTCRX509EXTENSIONS, RTCrX509Extensions, 1);
|
---|
71 | RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(TaTitleLangTag, RTASN1TMPL_MEMBER_CONSTR_MIN_MAX(TaTitleLangTag, RTASN1STRING, RTAsn1String, 2, 4, RT_NOTHING));
|
---|
72 | RTASN1TMPL_END_SEQCORE();
|
---|
73 | #undef RTASN1TMPL_TYPE
|
---|
74 | #undef RTASN1TMPL_EXT_NAME
|
---|
75 | #undef RTASN1TMPL_INT_NAME
|
---|
76 |
|
---|
77 |
|
---|
78 | /*
|
---|
79 | * TrustAnchorChoice.
|
---|
80 | */
|
---|
81 | #define RTASN1TMPL_TYPE RTCRTAFTRUSTANCHORCHOICE
|
---|
82 | #define RTASN1TMPL_EXT_NAME RTCrTafTrustAnchorChoice
|
---|
83 | #define RTASN1TMPL_INT_NAME rtCrTafTrustAnchorChoice
|
---|
84 | RTASN1TMPL_BEGIN_PCHOICE();
|
---|
85 | RTASN1TMPL_PCHOICE_ITAG(ASN1_TAG_SEQUENCE, RTCRTAFTRUSTANCHORCHOICEVAL_CERTIFICATE, u.pCertificate, Certificate, RTCRX509CERTIFICATE, RTCrX509Certificate);
|
---|
86 | RTASN1TMPL_PCHOICE_XTAG(1, RTCRTAFTRUSTANCHORCHOICEVAL_TBS_CERTIFICATE, u.pT1, CtxTag1, TbsCert, RTCRX509TBSCERTIFICATE, RTCrX509TbsCertificate);
|
---|
87 | RTASN1TMPL_PCHOICE_XTAG(2, RTCRTAFTRUSTANCHORCHOICEVAL_TRUST_ANCHOR_INFO, u.pT2, CtxTag2, TaInfo, RTCRTAFTRUSTANCHORINFO, RTCrTafTrustAnchorInfo);
|
---|
88 | RTASN1TMPL_END_PCHOICE();
|
---|
89 | #undef RTASN1TMPL_TYPE
|
---|
90 | #undef RTASN1TMPL_EXT_NAME
|
---|
91 | #undef RTASN1TMPL_INT_NAME
|
---|
92 |
|
---|
93 |
|
---|
94 | /*
|
---|
95 | * TrustAnchorList
|
---|
96 | */
|
---|
97 | #define RTASN1TMPL_TYPE RTCRTAFTRUSTANCHORLIST
|
---|
98 | #define RTASN1TMPL_EXT_NAME RTCrTafTrustAnchorList
|
---|
99 | #define RTASN1TMPL_INT_NAME rtCrTafTrustAnchorList
|
---|
100 | RTASN1TMPL_SEQ_OF(RTCRTAFTRUSTANCHORCHOICE, RTCrTafTrustAnchorChoice);
|
---|
101 | #undef RTASN1TMPL_TYPE
|
---|
102 | #undef RTASN1TMPL_EXT_NAME
|
---|
103 | #undef RTASN1TMPL_INT_NAME
|
---|
104 |
|
---|