Leancrypto 1.7.2
Post-Quantum Cryptographic Library
lc_asn1.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 - 2026, Stephan Mueller <smueller@chronox.de>
3 *
4 * License: see LICENSE file in root directory
5 *
6 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
7 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
9 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
10 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
11 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
12 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
13 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
16 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
17 * DAMAGE.
18 */
19/*
20 * This code is derived in parts from the Linux kernel
21 * License: SPDX-License-Identifier: GPL-2.0-or-later
22 *
23 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
24 * Written by David Howells (dhowells@redhat.com)
25 */
26/*
27 * Red Hat granted the following additional license to the leancrypto project:
28 * SPDX-License-Identifier: BSD-3-Clause
29 */
30
31#ifndef LC_ASN1_H
32#define LC_ASN1_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/*
39 * OIDs are turned into these values if possible, or OID__NR if not held here.
40 *
41 * NOTE! Do not mess with the format of each line as this is read by
42 * build_OID_registry.pl to generate the data for look_up_OID().
43 */
44enum OID {
45 OID_id_dsa_with_sha1, /* 1.2.840.10030.4.3 */
46 OID_id_dsa, /* 1.2.840.10040.4.1 */
47 OID_id_ecPublicKey, /* 1.2.840.10045.2.1 */
48 OID_id_prime192v1, /* 1.2.840.10045.3.1.1 */
49 OID_id_prime256v1, /* 1.2.840.10045.3.1.7 */
50 OID_id_ecdsa_with_sha1, /* 1.2.840.10045.4.1 */
51 OID_id_ecdsa_with_sha224, /* 1.2.840.10045.4.3.1 */
52 OID_id_ecdsa_with_sha256, /* 1.2.840.10045.4.3.2 */
53 OID_id_ecdsa_with_sha384, /* 1.2.840.10045.4.3.3 */
54 OID_id_ecdsa_with_sha512, /* 1.2.840.10045.4.3.4 */
55
56 /* PKCS#1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)} */
57 OID_rsaEncryption, /* 1.2.840.113549.1.1.1 */
58 OID_sha1WithRSAEncryption, /* 1.2.840.113549.1.1.5 */
59 OID_sha256WithRSAEncryption, /* 1.2.840.113549.1.1.11 */
60 OID_sha384WithRSAEncryption, /* 1.2.840.113549.1.1.12 */
61 OID_sha512WithRSAEncryption, /* 1.2.840.113549.1.1.13 */
62 OID_sha224WithRSAEncryption, /* 1.2.840.113549.1.1.14 */
63 /* PKCS#7 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-7(7)} */
64 OID_data, /* 1.2.840.113549.1.7.1 */
65 OID_signed_data, /* 1.2.840.113549.1.7.2 */
66 /* PKCS#9 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)} */
67 OID_email_address, /* 1.2.840.113549.1.9.1 */
68 OID_contentType, /* 1.2.840.113549.1.9.3 */
69 OID_messageDigest, /* 1.2.840.113549.1.9.4 */
70 OID_signingTime, /* 1.2.840.113549.1.9.5 */
71 OID_smimeCapabilites, /* 1.2.840.113549.1.9.15 */
72 OID_smimeAuthenticatedAttrs, /* 1.2.840.113549.1.9.16.2.11 */
73
74 OID_mskrb5, /* 1.2.840.48018.1.2.2 */
75 OID_krb5, /* 1.2.840.113554.1.2.2 */
76 OID_krb5u2u, /* 1.2.840.113554.1.2.2.3 */
77
78 /* Microsoft Authenticode & Software Publishing */
79 OID_msIndirectData, /* 1.3.6.1.4.1.311.2.1.4 */
80 OID_msStatementType, /* 1.3.6.1.4.1.311.2.1.11 */
81 OID_msSpOpusInfo, /* 1.3.6.1.4.1.311.2.1.12 */
82 OID_msPeImageDataObjId, /* 1.3.6.1.4.1.311.2.1.15 */
83 OID_msIndividualSPKeyPurpose, /* 1.3.6.1.4.1.311.2.1.21 */
84 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */
85
86 OID_ntlmssp, /* 1.3.6.1.4.1.311.2.2.10 */
87 OID_negoex, /* 1.3.6.1.4.1.311.2.2.30 */
88
89 OID_spnego, /* 1.3.6.1.5.5.2 */
90
91 OID_IAKerb, /* 1.3.6.1.5.2.5 */
92 OID_PKU2U, /* 1.3.5.1.5.2.7 */
93 OID_Scram, /* 1.3.6.1.5.5.14 */
94 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */
95 OID_sha1, /* 1.3.14.3.2.26 */
96 OID_id_ansip384r1, /* 1.3.132.0.34 */
97 OID_id_ansip521r1, /* 1.3.132.0.35 */
98 OID_sha256, /* 2.16.840.1.101.3.4.2.1 */
99 OID_sha384, /* 2.16.840.1.101.3.4.2.2 */
100 OID_sha512, /* 2.16.840.1.101.3.4.2.3 */
101 OID_sha224, /* 2.16.840.1.101.3.4.2.4 */
102
103 /* Distinguished Name attribute IDs [RFC 2256] */
104 OID_commonName, /* 2.5.4.3 */
105 OID_surname, /* 2.5.4.4 */
106 OID_countryName, /* 2.5.4.6 */
107 OID_locality, /* 2.5.4.7 */
109 OID_organizationName, /* 2.5.4.10 */
111 OID_title, /* 2.5.4.12 */
112 OID_description, /* 2.5.4.13 */
113 OID_name, /* 2.5.4.41 */
114 OID_givenName, /* 2.5.4.42 */
115 OID_initials, /* 2.5.4.43 */
117
118 /* Certificate extension IDs */
120 OID_keyUsage, /* 2.5.29.15 */
121 OID_subjectAltName, /* 2.5.29.17 */
122 OID_issuerAltName, /* 2.5.29.18 */
123 OID_basicConstraints, /* 2.5.29.19 */
124 OID_nameConstraints, /* 2.5.29.30 */
126 OID_certPolicies, /* 2.5.29.32 */
128 OID_extKeyUsage, /* 2.5.29.37 */
129
130 /* Extended Key Usage */
131 OID_anyExtendedKeyUsage, /* 2.5.29.37.0 */
132 OID_id_kp_serverAuth, /* 1.3.6.1.5.5.7.3.1 */
133 OID_id_kp_clientAuth, /* 1.3.6.1.5.5.7.3.2 */
134 OID_id_kp_codeSigning, /* 1.3.6.1.5.5.7.3.3 */
135 OID_id_kp_emailProtection, /* 1.3.6.1.5.5.7.3.4 */
136 OID_id_kp_timeStamping, /* 1.3.6.1.5.5.7.3.8 */
137 OID_id_kp_OCSPSigning, /* 1.3.6.1.5.5.7.3.9 */
138 OID_id_kp_ModuleSigning, /* 1.3.6.1.4.1.2312.16.1.2 */
139
140 /* Heimdal mechanisms */
141 OID_NetlogonMechanism, /* 1.2.752.43.14.2 */
142 OID_appleLocalKdcSupported, /* 1.2.752.43.14.3 */
143
144 /* EC-RDSA */
145 OID_gostCPSignA, /* 1.2.643.2.2.35.1 */
146 OID_gostCPSignB, /* 1.2.643.2.2.35.2 */
147 OID_gostCPSignC, /* 1.2.643.2.2.35.3 */
148 OID_gost2012PKey256, /* 1.2.643.7.1.1.1.1 */
149 OID_gost2012PKey512, /* 1.2.643.7.1.1.1.2 */
150 OID_gost2012Digest256, /* 1.2.643.7.1.1.2.2 */
151 OID_gost2012Digest512, /* 1.2.643.7.1.1.2.3 */
152 OID_gost2012Signature256, /* 1.2.643.7.1.1.3.2 */
153 OID_gost2012Signature512, /* 1.2.643.7.1.1.3.3 */
154 OID_gostTC26Sign256A, /* 1.2.643.7.1.2.1.1.1 */
155 OID_gostTC26Sign256B, /* 1.2.643.7.1.2.1.1.2 */
156 OID_gostTC26Sign256C, /* 1.2.643.7.1.2.1.1.3 */
157 OID_gostTC26Sign256D, /* 1.2.643.7.1.2.1.1.4 */
158 OID_gostTC26Sign512A, /* 1.2.643.7.1.2.1.2.1 */
159 OID_gostTC26Sign512B, /* 1.2.643.7.1.2.1.2.2 */
160 OID_gostTC26Sign512C, /* 1.2.643.7.1.2.1.2.3 */
161
162 /* OSCCA */
163 OID_sm2, /* 1.2.156.10197.1.301 */
164 OID_sm3, /* 1.2.156.10197.1.401 */
165 OID_SM2_with_SM3, /* 1.2.156.10197.1.501 */
166 OID_sm3WithRSAEncryption, /* 1.2.156.10197.1.504 */
167
168 /* TCG defined OIDS for TPM based keys */
169 OID_TPMLoadableKey, /* 2.23.133.10.1.3 */
170 OID_TPMImportableKey, /* 2.23.133.10.1.4 */
171 OID_TPMSealedData, /* 2.23.133.10.1.5 */
172
173 /* CSOR FIPS-202 SHA-3 */
174 OID_sha3_256, /* 2.16.840.1.101.3.4.2.8 */
175 OID_sha3_384, /* 2.16.840.1.101.3.4.2.9 */
176 OID_sha3_512, /* 2.16.840.1.101.3.4.2.10 */
177 OID_shake128, /* 2.16.840.1.101.3.4.2.11 */
178 OID_shake256, /* 2.16.840.1.101.3.4.2.12 */
179 OID_id_ecdsa_with_sha3_256, /* 2.16.840.1.101.3.4.3.10 */
180 OID_id_ecdsa_with_sha3_384, /* 2.16.840.1.101.3.4.3.11 */
181 OID_id_ecdsa_with_sha3_512, /* 2.16.840.1.101.3.4.3.12 */
182 OID_id_rsassa_pkcs1_v1_5_with_sha3_256, /* 2.16.840.1.101.3.4.3.14 */
183 OID_id_rsassa_pkcs1_v1_5_with_sha3_384, /* 2.16.840.1.101.3.4.3.15 */
184 OID_id_rsassa_pkcs1_v1_5_with_sha3_512, /* 2.16.840.1.101.3.4.3.16 */
185
186 /* OIDs from RFC9881 */
187 OID_id_MLDSA44, /* 2.16.840.1.101.3.4.3.17 */
188 OID_id_MLDSA65, /* 2.16.840.1.101.3.4.3.18 */
189 OID_id_MLDSA87, /* 2.16.840.1.101.3.4.3.19 */
190
191 /* https://lamps-wg.github.io/draft-composite-sigs/draft-ietf-lamps-pq-composite-sigs.html */
192 OID_id_MLDSA44_Ed25519, /* 1.3.6.1.5.5.7.6.39 */
193 OID_id_MLDSA65_Ed25519, /* 1.3.6.1.5.5.7.6.48 */
194 OID_id_MLDSA87_Ed448, /* 1.3.6.1.5.5.7.6.51 */
195
196 /* OIDs from RFC9814 */
197 OID_id_SLHDSA_SHAKE_128S, /* 2.16.840.1.101.3.4.3.26 */
198 OID_id_SLHDSA_SHAKE_128F, /* 2.16.840.1.101.3.4.3.27 */
199 OID_id_SLHDSA_SHAKE_192S, /* 2.16.840.1.101.3.4.3.28 */
200 OID_id_SLHDSA_SHAKE_192F, /* 2.16.840.1.101.3.4.3.29 */
201 OID_id_SLHDSA_SHAKE_256S, /* 2.16.840.1.101.3.4.3.30 */
202 OID_id_SLHDSA_SHAKE_256F, /* 2.16.840.1.101.3.4.3.31 */
203
204 OID__NR
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif /* LC_ASN1_H */
OID
Definition: lc_asn1.h:44
@ OID_appleLocalKdcSupported
Definition: lc_asn1.h:142
@ OID_stateOrProvinceName
Definition: lc_asn1.h:108
@ OID_SM2_with_SM3
Definition: lc_asn1.h:165
@ OID_id_dsa
Definition: lc_asn1.h:46
@ OID_email_address
Definition: lc_asn1.h:67
@ OID_nameConstraints
Definition: lc_asn1.h:124
@ OID_sha1WithRSAEncryption
Definition: lc_asn1.h:58
@ OID_commonName
Definition: lc_asn1.h:104
@ OID_ntlmssp
Definition: lc_asn1.h:86
@ OID_organizationName
Definition: lc_asn1.h:109
@ OID_sha3_256
Definition: lc_asn1.h:174
@ OID_gost2012PKey512
Definition: lc_asn1.h:149
@ OID_id_SLHDSA_SHAKE_256S
Definition: lc_asn1.h:201
@ OID_id_rsassa_pkcs1_v1_5_with_sha3_512
Definition: lc_asn1.h:184
@ OID_messageDigest
Definition: lc_asn1.h:69
@ OID_id_ansip521r1
Definition: lc_asn1.h:97
@ OID_gostTC26Sign256C
Definition: lc_asn1.h:156
@ OID_gostCPSignC
Definition: lc_asn1.h:147
@ OID_subjectKeyIdentifier
Definition: lc_asn1.h:119
@ OID_id_SLHDSA_SHAKE_256F
Definition: lc_asn1.h:202
@ OID_basicConstraints
Definition: lc_asn1.h:123
@ OID_spnego
Definition: lc_asn1.h:89
@ OID_id_ecdsa_with_sha3_384
Definition: lc_asn1.h:180
@ OID_initials
Definition: lc_asn1.h:115
@ OID_id_ecdsa_with_sha3_512
Definition: lc_asn1.h:181
@ OID_id_MLDSA44_Ed25519
Definition: lc_asn1.h:192
@ OID_id_prime256v1
Definition: lc_asn1.h:49
@ OID_id_ecdsa_with_sha256
Definition: lc_asn1.h:52
@ OID_Scram
Definition: lc_asn1.h:93
@ OID_smimeAuthenticatedAttrs
Definition: lc_asn1.h:72
@ OID_smimeCapabilites
Definition: lc_asn1.h:71
@ OID_id_ecdsa_with_sha3_256
Definition: lc_asn1.h:179
@ OID_id_MLDSA87_Ed448
Definition: lc_asn1.h:194
@ OID_id_ecPublicKey
Definition: lc_asn1.h:47
@ OID_sha3_384
Definition: lc_asn1.h:175
@ OID_IAKerb
Definition: lc_asn1.h:91
@ OID_id_kp_timeStamping
Definition: lc_asn1.h:136
@ OID_sm2
Definition: lc_asn1.h:163
@ OID_sha3_512
Definition: lc_asn1.h:176
@ OID_msSpOpusInfo
Definition: lc_asn1.h:81
@ OID_TPMImportableKey
Definition: lc_asn1.h:170
@ OID_id_rsassa_pkcs1_v1_5_with_sha3_256
Definition: lc_asn1.h:182
@ OID_id_SLHDSA_SHAKE_128S
Definition: lc_asn1.h:197
@ OID_description
Definition: lc_asn1.h:112
@ OID_sha224WithRSAEncryption
Definition: lc_asn1.h:62
@ OID_msStatementType
Definition: lc_asn1.h:80
@ OID_gost2012PKey256
Definition: lc_asn1.h:148
@ OID_sm3WithRSAEncryption
Definition: lc_asn1.h:166
@ OID_id_MLDSA44
Definition: lc_asn1.h:187
@ OID_id_kp_OCSPSigning
Definition: lc_asn1.h:137
@ OID_NetlogonMechanism
Definition: lc_asn1.h:141
@ OID_id_MLDSA65_Ed25519
Definition: lc_asn1.h:193
@ OID_id_kp_serverAuth
Definition: lc_asn1.h:132
@ OID_shake128
Definition: lc_asn1.h:177
@ OID_TPMSealedData
Definition: lc_asn1.h:171
@ OID_countryName
Definition: lc_asn1.h:106
@ OID_sha384WithRSAEncryption
Definition: lc_asn1.h:60
@ OID_id_kp_emailProtection
Definition: lc_asn1.h:135
@ OID_contentType
Definition: lc_asn1.h:68
@ OID_sha1
Definition: lc_asn1.h:95
@ OID_gostTC26Sign256D
Definition: lc_asn1.h:157
@ OID_signed_data
Definition: lc_asn1.h:65
@ OID_gostTC26Sign256A
Definition: lc_asn1.h:154
@ OID_TPMLoadableKey
Definition: lc_asn1.h:169
@ OID_givenName
Definition: lc_asn1.h:114
@ OID_gost2012Digest512
Definition: lc_asn1.h:151
@ OID_msIndirectData
Definition: lc_asn1.h:79
@ OID_certAuthInfoAccess
Definition: lc_asn1.h:94
@ OID__NR
Definition: lc_asn1.h:204
@ OID_id_MLDSA87
Definition: lc_asn1.h:189
@ OID_sm3
Definition: lc_asn1.h:164
@ OID_msOutlookExpress
Definition: lc_asn1.h:84
@ OID_title
Definition: lc_asn1.h:111
@ OID_sha256WithRSAEncryption
Definition: lc_asn1.h:59
@ OID_extKeyUsage
Definition: lc_asn1.h:128
@ OID_negoex
Definition: lc_asn1.h:87
@ OID_id_ecdsa_with_sha1
Definition: lc_asn1.h:50
@ OID_gostTC26Sign512A
Definition: lc_asn1.h:158
@ OID_authorityKeyIdentifier
Definition: lc_asn1.h:127
@ OID_krb5
Definition: lc_asn1.h:75
@ OID_keyUsage
Definition: lc_asn1.h:120
@ OID_data
Definition: lc_asn1.h:64
@ OID_sha512
Definition: lc_asn1.h:100
@ OID_id_kp_codeSigning
Definition: lc_asn1.h:134
@ OID_id_ecdsa_with_sha512
Definition: lc_asn1.h:54
@ OID_krb5u2u
Definition: lc_asn1.h:76
@ OID_id_MLDSA65
Definition: lc_asn1.h:188
@ OID_locality
Definition: lc_asn1.h:107
@ OID_id_ansip384r1
Definition: lc_asn1.h:96
@ OID_sha512WithRSAEncryption
Definition: lc_asn1.h:61
@ OID_id_ecdsa_with_sha224
Definition: lc_asn1.h:51
@ OID_sha384
Definition: lc_asn1.h:99
@ OID_subjectAltName
Definition: lc_asn1.h:121
@ OID_gostTC26Sign512B
Definition: lc_asn1.h:159
@ OID_gostCPSignA
Definition: lc_asn1.h:145
@ OID_sha224
Definition: lc_asn1.h:101
@ OID_issuerAltName
Definition: lc_asn1.h:122
@ OID_gost2012Signature512
Definition: lc_asn1.h:153
@ OID_shake256
Definition: lc_asn1.h:178
@ OID_id_dsa_with_sha1
Definition: lc_asn1.h:45
@ OID_certPolicies
Definition: lc_asn1.h:126
@ OID_gost2012Signature256
Definition: lc_asn1.h:152
@ OID_msPeImageDataObjId
Definition: lc_asn1.h:82
@ OID_name
Definition: lc_asn1.h:113
@ OID_surname
Definition: lc_asn1.h:105
@ OID_id_SLHDSA_SHAKE_192S
Definition: lc_asn1.h:199
@ OID_gostCPSignB
Definition: lc_asn1.h:146
@ OID_mskrb5
Definition: lc_asn1.h:74
@ OID_id_rsassa_pkcs1_v1_5_with_sha3_384
Definition: lc_asn1.h:183
@ OID_PKU2U
Definition: lc_asn1.h:92
@ OID_gostTC26Sign256B
Definition: lc_asn1.h:155
@ OID_id_prime192v1
Definition: lc_asn1.h:48
@ OID_id_SLHDSA_SHAKE_192F
Definition: lc_asn1.h:200
@ OID_id_kp_ModuleSigning
Definition: lc_asn1.h:138
@ OID_rsaEncryption
Definition: lc_asn1.h:57
@ OID_id_SLHDSA_SHAKE_128F
Definition: lc_asn1.h:198
@ OID_organizationUnitName
Definition: lc_asn1.h:110
@ OID_anyExtendedKeyUsage
Definition: lc_asn1.h:131
@ OID_generationalQualifier
Definition: lc_asn1.h:116
@ OID_id_kp_clientAuth
Definition: lc_asn1.h:133
@ OID_crlDistributionPoints
Definition: lc_asn1.h:125
@ OID_msIndividualSPKeyPurpose
Definition: lc_asn1.h:83
@ OID_gost2012Digest256
Definition: lc_asn1.h:150
@ OID_gostTC26Sign512C
Definition: lc_asn1.h:160
@ OID_id_ecdsa_with_sha384
Definition: lc_asn1.h:53
@ OID_signingTime
Definition: lc_asn1.h:70
@ OID_sha256
Definition: lc_asn1.h:98