Skip to main content

rustflexstack/security/
security_asn.rs

1#[allow(
2    non_camel_case_types,
3    non_snake_case,
4    non_upper_case_globals,
5    unused,
6    clippy::too_many_arguments
7)]
8pub mod etsi_ts103097_extension_module {
9    extern crate alloc;
10    use super::ieee1609_dot2_base_types::*;
11    use core::borrow::Borrow;
12    use rasn::prelude::*;
13    use std::sync::LazyLock;
14    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
15    #[rasn(automatic_tags)]
16    pub struct EtsiOriginatingHeaderInfoExtension {
17        #[rasn(value("0..=255"))]
18        pub id: u8,
19        pub content: OctetString,
20    }
21    impl EtsiOriginatingHeaderInfoExtension {
22        pub fn new(id: u8, content: OctetString) -> Self {
23            Self { id, content }
24        }
25    }
26    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
27    #[rasn(automatic_tags)]
28    pub struct EtsiTs102941CrlRequest {
29        #[rasn(identifier = "issuerId")]
30        pub issuer_id: HashedId8,
31        #[rasn(identifier = "lastKnownUpdate")]
32        pub last_known_update: Option<Time32>,
33    }
34    impl EtsiTs102941CrlRequest {
35        pub fn new(issuer_id: HashedId8, last_known_update: Option<Time32>) -> Self {
36            Self {
37                issuer_id,
38                last_known_update,
39            }
40        }
41    }
42    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
43    #[rasn(automatic_tags)]
44    pub struct EtsiTs102941CtlRequest {
45        #[rasn(identifier = "issuerId")]
46        pub issuer_id: HashedId8,
47        #[rasn(identifier = "lastKnownCtlSequence")]
48        pub last_known_ctl_sequence: Option<Uint8>,
49    }
50    impl EtsiTs102941CtlRequest {
51        pub fn new(issuer_id: HashedId8, last_known_ctl_sequence: Option<Uint8>) -> Self {
52            Self {
53                issuer_id,
54                last_known_ctl_sequence,
55            }
56        }
57    }
58    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
59    #[rasn(delegate)]
60    pub struct EtsiTs102941DeltaCtlRequest(pub EtsiTs102941CtlRequest);
61    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
62    #[rasn(automatic_tags)]
63    pub struct EtsiTs102941FullCtlRequest {
64        #[rasn(identifier = "issuerId")]
65        pub issuer_id: HashedId8,
66        #[rasn(identifier = "lastKnownCtlSequence")]
67        pub last_known_ctl_sequence: Option<Uint8>,
68        #[rasn(identifier = "segmentNumber")]
69        pub segment_number: Option<Uint8>,
70    }
71    impl EtsiTs102941FullCtlRequest {
72        pub fn new(
73            issuer_id: HashedId8,
74            last_known_ctl_sequence: Option<Uint8>,
75            segment_number: Option<Uint8>,
76        ) -> Self {
77            Self {
78                issuer_id,
79                last_known_ctl_sequence,
80                segment_number,
81            }
82        }
83    }
84    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
85    #[rasn(delegate)]
86    pub struct EtsiTs103097HeaderInfoExtensionId(pub ExtId);
87    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
88    #[rasn(delegate, value("2"))]
89    pub struct ExtensionModuleVersion(pub u8);
90    pub const ETSI_TS102941_CRL_REQUEST_ID: EtsiTs103097HeaderInfoExtensionId =
91        EtsiTs103097HeaderInfoExtensionId(ExtId(1));
92    #[doc = "'01'H"]
93    pub const ETSI_TS102941_DELTA_CTL_REQUEST_ID: EtsiTs103097HeaderInfoExtensionId =
94        EtsiTs103097HeaderInfoExtensionId(ExtId(2));
95    #[doc = "'02'H"]
96    pub const ETSI_TS102941_FULL_CTL_REQUEST_ID: EtsiTs103097HeaderInfoExtensionId =
97        EtsiTs103097HeaderInfoExtensionId(ExtId(3));
98}
99#[allow(
100    non_camel_case_types,
101    non_snake_case,
102    non_upper_case_globals,
103    unused,
104    clippy::too_many_arguments
105)]
106pub mod etsi_ts103097_module {
107    extern crate alloc;
108    use super::etsi_ts103097_extension_module::ExtensionModuleVersion;
109    use super::ieee1609_dot2::{Certificate, Ieee1609Dot2Data};
110    use core::borrow::Borrow;
111    use rasn::prelude::*;
112    use std::sync::LazyLock;
113    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
114    #[rasn(delegate)]
115    pub struct EtsiTs103097Certificate(pub Certificate);
116    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
117    #[rasn(delegate)]
118    pub struct EtsiTs103097Data(pub Ieee1609Dot2Data);
119    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
120    #[rasn(delegate, identifier = "EtsiTs103097Data-SignedExternalPayload")]
121    pub struct EtsiTs103097DataSignedExternalPayload(pub EtsiTs103097Data);
122}
123#[allow(
124    non_camel_case_types,
125    non_snake_case,
126    non_upper_case_globals,
127    unused,
128    clippy::too_many_arguments
129)]
130pub mod ieee1609_dot2 {
131    extern crate alloc;
132    use super::etsi_ts103097_extension_module::EtsiOriginatingHeaderInfoExtension;
133    use super::ieee1609_dot2_base_types::*;
134    use core::borrow::Borrow;
135    use rasn::prelude::*;
136    use std::sync::LazyLock;
137    #[doc = "*"]
138    #[doc = " * @brief This type is defined only for backwards compatibility."]
139    #[doc = " "]
140    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
141    #[rasn(delegate)]
142    pub struct Aes128CcmCiphertext(pub One28BitCcmCiphertext);
143    #[doc = "*"]
144    #[doc = " * @brief This structure contains an individual AppExtension. AppExtensions "]
145    #[doc = " * specified in this standard are drawn from the ASN.1 Information Object Set "]
146    #[doc = " * SetCertExtensions. This set, and its use in the AppExtension type, is "]
147    #[doc = " * structured so that each AppExtension is associated with a "]
148    #[doc = " * CertIssueExtension and a CertRequestExtension and all are identified by "]
149    #[doc = " * the same id value. In this structure:"]
150    #[doc = " * "]
151    #[doc = " * @param id: identifies the extension type."]
152    #[doc = " * "]
153    #[doc = " * @param content: provides the content of the extension."]
154    #[doc = " "]
155    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
156    #[rasn(automatic_tags)]
157    pub struct AppExtension {
158        pub id: ExtId,
159        pub content: OctetString,
160    }
161    impl AppExtension {
162        pub fn new(id: ExtId, content: OctetString) -> Self {
163            Self { id, content }
164        }
165    }
166    #[doc = " Inner type "]
167    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
168    #[rasn(choice, automatic_tags)]
169    pub enum CertIssueExtensionPermissions {
170        specific(Any),
171        all(()),
172    }
173    #[doc = "*"]
174    #[doc = " * @brief This field contains an individual CertIssueExtension. "]
175    #[doc = " * CertIssueExtensions specified in this standard are drawn from the ASN.1 "]
176    #[doc = " * Information Object Set SetCertExtensions. This set, and its use in the "]
177    #[doc = " * CertIssueExtension type, is structured so that each CertIssueExtension "]
178    #[doc = " * is associated with a AppExtension and a CertRequestExtension and all are "]
179    #[doc = " * identified by the same id value. In this structure:"]
180    #[doc = " * "]
181    #[doc = " * @param id: identifies the extension type."]
182    #[doc = " * "]
183    #[doc = " * @param permissions: indicates the permissions. Within this field."]
184    #[doc = " *   - all indicates that the certificate is entitled to issue all values of"]
185    #[doc = " * the extension."]
186    #[doc = " *   - specific is used to specify which values of the extension may be "]
187    #[doc = " * issued in the case where all does not apply."]
188    #[doc = " "]
189    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
190    #[rasn(automatic_tags)]
191    pub struct CertIssueExtension {
192        pub id: ExtId,
193        pub permissions: CertIssueExtensionPermissions,
194    }
195    impl CertIssueExtension {
196        pub fn new(id: ExtId, permissions: CertIssueExtensionPermissions) -> Self {
197            Self { id, permissions }
198        }
199    }
200    #[doc = " Inner type "]
201    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
202    #[rasn(choice, automatic_tags)]
203    pub enum CertRequestExtensionPermissions {
204        content(Any),
205        all(()),
206    }
207    #[doc = "*"]
208    #[doc = " * @brief This field contains an individual CertRequestExtension. "]
209    #[doc = " * CertRequestExtensions specified in this standard are drawn from the "]
210    #[doc = " * ASN.1 Information Object Set SetCertExtensions. This set, and its use in "]
211    #[doc = " * the CertRequestExtension type, is structured so that each "]
212    #[doc = " * CertRequestExtension is associated with a AppExtension and a "]
213    #[doc = " * CertRequestExtension and all are identified by the same id value. In this "]
214    #[doc = " * structure:"]
215    #[doc = " * "]
216    #[doc = " * @param id: identifies the extension type."]
217    #[doc = " * "]
218    #[doc = " * @param permissions: indicates the permissions. Within this field."]
219    #[doc = " *   - all indicates that the certificate is entitled to issue all values of"]
220    #[doc = " * the extension."]
221    #[doc = " *   - specific is used to specify which values of the extension may be "]
222    #[doc = " * issued in the case where all does not apply."]
223    #[doc = " "]
224    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
225    #[rasn(automatic_tags)]
226    pub struct CertRequestExtension {
227        pub id: ExtId,
228        pub permissions: CertRequestExtensionPermissions,
229    }
230    impl CertRequestExtension {
231        pub fn new(id: ExtId, permissions: CertRequestExtensionPermissions) -> Self {
232            Self { id, permissions }
233        }
234    }
235    #[doc = "***************************************************************************"]
236    #[doc = "                Certificates and other Security Management                 "]
237    #[doc = "***************************************************************************"]
238    #[doc = "*"]
239    #[doc = " * @brief This structure is a profile of the structure CertificateBase, which"]
240    #[doc = " * specifies the valid combinations of fields to transmit implicit and"]
241    #[doc = " * explicit certificates."]
242    #[doc = " *"]
243    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
244    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
245    #[doc = " * applies to the CertificateBase."]
246    #[doc = " "]
247    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
248    #[rasn(delegate)]
249    pub struct Certificate(pub CertificateBase);
250    #[doc = "*"]
251    #[doc = " * @brief The fields in this structure have the following meaning:"]
252    #[doc = " *"]
253    #[doc = " * @param version: contains the version of the certificate format. In this"]
254    #[doc = " * version of the data structures, this field is set to 3."]
255    #[doc = " *"]
256    #[doc = " * @param type: states whether the certificate is implicit or explicit. This"]
257    #[doc = " * field is set to explicit for explicit certificates and to implicit for"]
258    #[doc = " * implicit certificates. See ExplicitCertificate and ImplicitCertificate for"]
259    #[doc = " * more details."]
260    #[doc = " *"]
261    #[doc = " * @param issuer: identifies the issuer of the certificate."]
262    #[doc = " *"]
263    #[doc = " * @param toBeSigned: is the certificate contents. This field is an input to"]
264    #[doc = " * the hash when generating or verifying signatures for an explicit"]
265    #[doc = " * certificate, or generating or verifying the public key from the"]
266    #[doc = " * reconstruction value for an implicit certificate. The details of how this"]
267    #[doc = " * field are encoded are given in the description of the"]
268    #[doc = " * ToBeSignedCertificate type."]
269    #[doc = " *"]
270    #[doc = " * @param signature: is included in an ExplicitCertificate. It is the"]
271    #[doc = " * signature, calculated by the signer identified in the issuer field, over"]
272    #[doc = " * the hash of toBeSigned. The hash is calculated as specified in 5.3.1, where:"]
273    #[doc = " *   - Data input is the encoding of toBeSigned, canonicalized as described"]
274    #[doc = " * next."]
275    #[doc = " *   - Signer identifier input depends on the verification type, which in"]
276    #[doc = " * turn depends on the choice indicated by issuer. If the choice indicated by"]
277    #[doc = " * issuer is self, the verification type is self-signed and the signer"]
278    #[doc = " * identifier input is the empty string. If the choice indicated by issuer is"]
279    #[doc = " * not self, the verification type is certificate and the signer identifier"]
280    #[doc = " * input is the canonicalized COER encoding of the certificate indicated by"]
281    #[doc = " * issuer. The canonicalization is carried out as specified in the "]
282    #[doc = " * Canonicalization section of this subclause."]
283    #[doc = " *"]
284    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
285    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
286    #[doc = " * applies to the ToBeSignedCertificate and to the Signature."]
287    #[doc = " *"]
288    #[doc = " * @note Whole-certificate hash: If the entirety of a certificate is hashed "]
289    #[doc = " * to calculate a HashedId3, HashedId8, or HashedId10, the algorithm used for "]
290    #[doc = " * this purpose is known as the whole-certificate hash. The method used to "]
291    #[doc = " * determine the whole-certificate hash algorithm is specified in 5.3.9.2."]
292    #[doc = " "]
293    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
294    #[rasn(automatic_tags)]
295    pub struct CertificateBase {
296        #[rasn(value("3"))]
297        pub version: Uint8,
298        #[rasn(identifier = "type")]
299        pub r_type: CertificateType,
300        pub issuer: IssuerIdentifier,
301        #[rasn(identifier = "toBeSigned")]
302        pub to_be_signed: ToBeSignedCertificate,
303        pub signature: Option<Signature>,
304    }
305    impl CertificateBase {
306        pub fn new(
307            version: Uint8,
308            r_type: CertificateType,
309            issuer: IssuerIdentifier,
310            to_be_signed: ToBeSignedCertificate,
311            signature: Option<Signature>,
312        ) -> Self {
313            Self {
314                version,
315                r_type,
316                issuer,
317                to_be_signed,
318                signature,
319            }
320        }
321    }
322    #[doc = "*"]
323    #[doc = " * @brief This structure contains information that is used to identify the"]
324    #[doc = " * certificate holder if necessary."]
325    #[doc = " *"]
326    #[doc = " * @param linkageData: is used to identify the certificate for revocation"]
327    #[doc = " * purposes in the case of certificates that appear on linked certificate"]
328    #[doc = " * CRLs. See 5.1.3 and 7.3 for further discussion."]
329    #[doc = " *"]
330    #[doc = " * @param name: is used to identify the certificate holder in the case of"]
331    #[doc = " * non-anonymous certificates. The contents of this field are a matter of"]
332    #[doc = " * policy and are expected to be human-readable."]
333    #[doc = " *"]
334    #[doc = " * @param binaryId: supports identifiers that are not human-readable."]
335    #[doc = " *"]
336    #[doc = " * @param none: indicates that the certificate does not include an identifier."]
337    #[doc = " *"]
338    #[doc = " * @note Critical information fields:"]
339    #[doc = " *   - If present, this is a critical information field as defined in 5.2.6."]
340    #[doc = " * An implementation that does not recognize the choice indicated in this"]
341    #[doc = " * field shall reject a signed SPDU as invalid."]
342    #[doc = " "]
343    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
344    #[rasn(choice, automatic_tags)]
345    #[non_exhaustive]
346    pub enum CertificateId {
347        linkageData(LinkageData),
348        name(Hostname),
349        #[rasn(size("1..=64"))]
350        binaryId(OctetString),
351        none(()),
352    }
353    #[doc = "*"]
354    #[doc = " * @brief This enumerated type indicates whether a certificate is explicit or"]
355    #[doc = " * implicit."]
356    #[doc = " *"]
357    #[doc = " * @note Critical information fields: If present, this is a critical"]
358    #[doc = " * information field as defined in 5.2.5. An implementation that does not"]
359    #[doc = " * recognize the indicated CHOICE for this type when verifying a signed SPDU"]
360    #[doc = " * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, "]
361    #[doc = " * that is, it is invalid in the sense that its validity cannot be "]
362    #[doc = " * established."]
363    #[doc = " "]
364    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
365    #[rasn(enumerated)]
366    #[non_exhaustive]
367    pub enum CertificateType {
368        explicit = 0,
369        implicit = 1,
370    }
371    #[doc = " Anonymous SEQUENCE OF member "]
372    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
373    #[rasn(
374        delegate,
375        identifier = "IOFR$IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION$&Extn"
376    )]
377    // Open type, as an OCTET STRING (same OER encoding; rasn cannot decode Any).
378    pub struct AnonymousContributedExtensionBlockExtns(pub OctetString);
379    #[doc = " Inner type "]
380    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
381    #[rasn(delegate, size("1.."))]
382    pub struct ContributedExtensionBlockExtns(
383        pub SequenceOf<AnonymousContributedExtensionBlockExtns>,
384    );
385    #[doc = "*"]
386    #[doc = " * @brief This data structure defines the format of an extension block"]
387    #[doc = " * provided by an identified contributor by using the temnplate provided"]
388    #[doc = " * in the class IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION constraint"]
389    #[doc = " * to the objects in the set Ieee1609Dot2HeaderInfoContributedExtensions."]
390    #[doc = " *"]
391    #[doc = " * @param contributorId: uniquely identifies the contributor."]
392    #[doc = " *"]
393    #[doc = " * @param extns: contains a list of extensions from that contributor. "]
394    #[doc = " * Extensions are expected and not required to follow the format specified "]
395    #[doc = " * in 6.5."]
396    #[doc = " "]
397    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
398    #[rasn(automatic_tags)]
399    pub struct ContributedExtensionBlock {
400        #[rasn(identifier = "contributorId")]
401        pub contributor_id: HeaderInfoContributorId,
402        pub extns: ContributedExtensionBlockExtns,
403    }
404    impl ContributedExtensionBlock {
405        pub fn new(
406            contributor_id: HeaderInfoContributorId,
407            extns: ContributedExtensionBlockExtns,
408        ) -> Self {
409            Self {
410                contributor_id,
411                extns,
412            }
413        }
414    }
415    #[doc = "*"]
416    #[doc = " * @brief This type is used for clarity of definitions."]
417    #[doc = " "]
418    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
419    #[rasn(delegate, size("1.."))]
420    pub struct ContributedExtensionBlocks(pub SequenceOf<ContributedExtensionBlock>);
421    #[doc = "*"]
422    #[doc = " * @brief This data structure is used to perform a countersignature over an"]
423    #[doc = " * already-signed SPDU. This is the profile of an Ieee1609Dot2Data containing"]
424    #[doc = " * a signedData. The tbsData within content is composed of a payload"]
425    #[doc = " * containing the hash (extDataHash) of the externally generated, pre-signed"]
426    #[doc = " * SPDU over which the countersignature is performed."]
427    #[doc = " "]
428    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
429    #[rasn(delegate)]
430    pub struct Countersignature(pub Ieee1609Dot2Data);
431    #[doc = "***************************************************************************"]
432    #[doc = "                              Encrypted Data                               "]
433    #[doc = "***************************************************************************"]
434    #[doc = "*"]
435    #[doc = " * @brief This data structure encodes data that has been encrypted to one or "]
436    #[doc = " * more recipients using the recipients� public or symmetric keys as "]
437    #[doc = " * specified in 5.3.4."]
438    #[doc = " *"]
439    #[doc = " * @param recipients: contains one or more RecipientInfos. These entries may"]
440    #[doc = " * be more than one RecipientInfo, and more than one type of RecipientInfo,"]
441    #[doc = " * as long as all entries are indicating or containing the same data encryption"]
442    #[doc = " * key."]
443    #[doc = " *"]
444    #[doc = " * @param ciphertext: contains the encrypted data. This is the encryption of"]
445    #[doc = " * an encoded Ieee1609Dot2Data structure as specified in 5.3.4.2."]
446    #[doc = " *"]
447    #[doc = " * @note Critical information fields:"]
448    #[doc = " *   - If present, recipients is a critical information field as defined in"]
449    #[doc = " * 5.2.6. An implementation that does not support the number of RecipientInfo"]
450    #[doc = " * in recipients when decrypted shall indicate that the encrypted SPDU could"]
451    #[doc = " * not be decrypted due to unsupported critical information fields. A"]
452    #[doc = " * compliant implementation shall support recipients fields containing at"]
453    #[doc = " * least eight entries."]
454    #[doc = " *"]
455    #[doc = " * @note If the plaintext is raw data, i.e., it has not been output from a "]
456    #[doc = " * previous operation of the SDS, then it is trivial to encapsulate it in an"]
457    #[doc = " * Ieee1609Dot2Data of type unsecuredData as noted in 4.2.2.2.2. For example,"]
458    #[doc = " * '03 80 08 01 23 45 67 89 AB CD EF' is the C-OER encoding of '01 23 45 67 "]
459    #[doc = " * 89 AB CD EF' encapsulated in an Ieee1609Dot2Data of type unsecuredData. "]
460    #[doc = " * The first byte of the encoding 03 is the protocolVersion, the second byte "]
461    #[doc = " * 80 indicates the choice unsecuredData, and the third byte 08 is the length "]
462    #[doc = " * of the raw data '01 23 45 67 89 AB CD EF'."]
463    #[doc = " "]
464    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
465    #[rasn(automatic_tags)]
466    pub struct EncryptedData {
467        pub recipients: SequenceOfRecipientInfo,
468        pub ciphertext: SymmetricCiphertext,
469    }
470    impl EncryptedData {
471        pub fn new(recipients: SequenceOfRecipientInfo, ciphertext: SymmetricCiphertext) -> Self {
472            Self {
473                recipients,
474                ciphertext,
475            }
476        }
477    }
478    #[doc = "*"]
479    #[doc = " * @brief This data structure contains an encrypted data encryption key, "]
480    #[doc = " * where the data encryption key is input to the data encryption key "]
481    #[doc = " * encryption process with no headers, encapsulation, or length indication."]
482    #[doc = " *"]
483    #[doc = " * Critical information fields: If present and applicable to"]
484    #[doc = " * the receiving SDEE, this is a critical information field as defined in"]
485    #[doc = " * 5.2.6. If an implementation receives an encrypted SPDU and determines that"]
486    #[doc = " * one or more RecipientInfo fields are relevant to it, and if all of those"]
487    #[doc = " * RecipientInfos contain an EncryptedDataEncryptionKey such that the"]
488    #[doc = " * implementation does not recognize the indicated CHOICE, the implementation"]
489    #[doc = " * shall indicate that the encrypted SPDU is not decryptable."]
490    #[doc = " "]
491    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
492    #[rasn(choice, automatic_tags)]
493    #[non_exhaustive]
494    pub enum EncryptedDataEncryptionKey {
495        eciesNistP256(EciesP256EncryptedKey),
496        eciesBrainpoolP256r1(EciesP256EncryptedKey),
497        #[rasn(extension_addition)]
498        ecencSm2256(EcencP256EncryptedKey),
499    }
500    #[doc = "*"]
501    #[doc = " * @brief This type indicates which type of permissions may appear in"]
502    #[doc = " * end-entity certificates the chain of whose permissions passes through the"]
503    #[doc = " * PsidGroupPermissions field containing this value. If app is indicated, the"]
504    #[doc = " * end-entity certificate may contain an appPermissions field. If enroll is"]
505    #[doc = " * indicated, the end-entity certificate may contain a certRequestPermissions"]
506    #[doc = " * field."]
507    #[doc = " "]
508    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
509    #[rasn(delegate)]
510    pub struct EndEntityType(pub FixedBitString<8usize>);
511    #[doc = "*"]
512    #[doc = " * @brief This is a profile of the CertificateBase structure providing all"]
513    #[doc = " * the fields necessary for an explicit certificate, and no others."]
514    #[doc = " "]
515    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
516    #[rasn(delegate)]
517    pub struct ExplicitCertificate(pub CertificateBase);
518    #[doc = "*"]
519    #[doc = " * @brief This structure contains the hash of some data with a specified hash"]
520    #[doc = " * algorithm. See 5.3.3 for specification of the permitted hash algorithms."]
521    #[doc = " *"]
522    #[doc = " * @param sha256HashedData: indicates data hashed with SHA-256."]
523    #[doc = " *"]
524    #[doc = " * @param sha384HashedData: indicates data hashed with SHA-384."]
525    #[doc = " * "]
526    #[doc = " * @param sm3HashedData: indicates data hashed with SM3."]
527    #[doc = " *"]
528    #[doc = " * @note Critical information fields: If present, this is a critical "]
529    #[doc = " * information field as defined in 5.2.6. An implementation that does not "]
530    #[doc = " * recognize the indicated CHOICE for this type when verifying a signed SPDU "]
531    #[doc = " * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, "]
532    #[doc = " * that is, it is invalid in the sense that its validity cannot be established."]
533    #[doc = " "]
534    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
535    #[rasn(choice, automatic_tags)]
536    #[non_exhaustive]
537    pub enum HashedData {
538        sha256HashedData(HashedId32),
539        #[rasn(extension_addition)]
540        sha384HashedData(HashedId48),
541        #[rasn(extension_addition)]
542        sm3HashedData(HashedId32),
543    }
544    #[doc = "*"]
545    #[doc = " * @brief This structure contains the following information that is used to establish"]
546    #[doc = " * validity by the criteria of 5.2."]
547    #[doc = " *"]
548    #[doc = " * @param psid: indicates the application area with which the sender is"]
549    #[doc = " * claiming the payload is to be associated."]
550    #[doc = " *"]
551    #[doc = " * @param generationTime: indicates the time at which the structure was"]
552    #[doc = " * generated. See 5.2.5.2.2 and 5.2.5.2.3 for discussion of the use of this"]
553    #[doc = " * field."]
554    #[doc = " *"]
555    #[doc = " * @param expiryTime: if present, contains the time after which the data"]
556    #[doc = " * is no longer considered relevant. If both generationTime and"]
557    #[doc = " * expiryTime are present, the signed SPDU is invalid if generationTime is"]
558    #[doc = " * not strictly earlier than expiryTime."]
559    #[doc = " *"]
560    #[doc = " * @param generationLocation: if present, contains the location at which the"]
561    #[doc = " * signature was generated."]
562    #[doc = " *"]
563    #[doc = " * @param p2pcdLearningRequest: if present, is used by the SDS to request "]
564    #[doc = " * certificates for which it has seen identifiers and does not know the "]
565    #[doc = " * entire certificate. A specification of this peer-to-peer certificate "]
566    #[doc = " * distribution (P2PCD) mechanism is given in Clause 8. This field is used "]
567    #[doc = " * for the separate-certificate-pdu flavor of P2PCD and shall only be present "]
568    #[doc = " * if inlineP2pcdRequest is not present. The HashedId3 is calculated with the "]
569    #[doc = " * whole-certificate hash algorithm, determined as described in 6.4.3, "]
570    #[doc = " * applied to the COER-encoded certificate, canonicalized as defined in the "]
571    #[doc = " * definition of Certificate."]
572    #[doc = " *"]
573    #[doc = " * @param missingCrlIdentifier: if present, is used by the SDS to request"]
574    #[doc = " * CRLs which it knows to have been issued and have not received. This is"]
575    #[doc = " * provided for future use and the associated mechanism is not defined in"]
576    #[doc = " * this version of this standard."]
577    #[doc = " *"]
578    #[doc = " * @param encryptionKey: if present, is used to provide a key that is to "]
579    #[doc = " * be used to encrypt at least one response to this SPDU. The SDEE "]
580    #[doc = " * specification is expected to specify which response SPDUs are to be "]
581    #[doc = " * encrypted with this key. One possible use of this key to encrypt a "]
582    #[doc = " * response is specified in 6.3.35, 6.3.37, and 6.3.34. An encryptionKey "]
583    #[doc = " * field of type symmetric should only be used if the SignedData containing "]
584    #[doc = " * this field is securely encrypted by some means."]
585    #[doc = " *"]
586    #[doc = " * @param inlineP2pcdRequest: if present, is used by the SDS to request"]
587    #[doc = " * unknown certificates per the inline peer-to-peer certificate distribution"]
588    #[doc = " * mechanism is given in Clause 8. This field shall only be present if"]
589    #[doc = " * p2pcdLearningRequest is not present. The HashedId3 is calculated with the"]
590    #[doc = " * whole-certificate hash algorithm, determined as described in 6.4.3, applied"]
591    #[doc = " * to the COER-encoded certificate, canonicalized as defined in the definition"]
592    #[doc = " * of Certificate."]
593    #[doc = " *"]
594    #[doc = " * @param requestedCertificate: if present, is used by the SDS to provide"]
595    #[doc = " * certificates per the \"inline\" version of the peer-to-peer certificate"]
596    #[doc = " * distribution mechanism given in Clause 8."]
597    #[doc = " *"]
598    #[doc = " * @param pduFunctionalType: if present, is used to indicate that the SPDU is"]
599    #[doc = " * to be consumed by a process other than an application process as defined"]
600    #[doc = " * in ISO 21177 [B14a]. See 6.3.23b for more details."]
601    #[doc = " *"]
602    #[doc = " * @param contributedExtensions: if present, is used to contain additional "]
603    #[doc = " * extensions defined using the ContributedExtensionBlocks structure."]
604    #[doc = " *"]
605    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
606    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization"]
607    #[doc = " * applies to the EncryptionKey. If encryptionKey is present, and indicates"]
608    #[doc = " * the choice public, and contains a BasePublicEncryptionKey that is an"]
609    #[doc = " * elliptic curve point (i.e., of type EccP256CurvePoint or "]
610    #[doc = " * EccP384CurvePoint), then the elliptic curve point is encoded in compressed"]
611    #[doc = " * form, i.e., such that the choice indicated within the Ecc*CurvePoint is"]
612    #[doc = " * compressed-y-0 or compressed-y-1."]
613    #[doc = " * The canonicalization does not apply to any fields after the extension "]
614    #[doc = " * marker, including any fields in contributedExtensions."]
615    #[doc = " "]
616    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
617    #[rasn(automatic_tags)]
618    #[non_exhaustive]
619    pub struct HeaderInfo {
620        pub psid: Psid,
621        #[rasn(identifier = "generationTime")]
622        pub generation_time: Option<Time64>,
623        #[rasn(identifier = "expiryTime")]
624        pub expiry_time: Option<Time64>,
625        #[rasn(identifier = "generationLocation")]
626        pub generation_location: Option<ThreeDLocation>,
627        #[rasn(identifier = "p2pcdLearningRequest")]
628        pub p2pcd_learning_request: Option<HashedId3>,
629        #[rasn(identifier = "missingCrlIdentifier")]
630        pub missing_crl_identifier: Option<MissingCrlIdentifier>,
631        #[rasn(identifier = "encryptionKey")]
632        pub encryption_key: Option<EncryptionKey>,
633        #[rasn(extension_addition, identifier = "inlineP2pcdRequest")]
634        pub inline_p2pcd_request: Option<SequenceOfHashedId3>,
635        #[rasn(extension_addition, identifier = "requestedCertificate")]
636        pub requested_certificate: Option<Certificate>,
637        // Constraints repeated on the extension-addition fields: rasn drops
638        // the constraints of a delegate type encoded as an extension addition
639        // (the INTEGER (0..255) was COER-encoded with a length octet).
640        #[rasn(extension_addition, value("0..=255"), identifier = "pduFunctionalType")]
641        pub pdu_functional_type: Option<PduFunctionalType>,
642        #[rasn(extension_addition, size("1.."), identifier = "contributedExtensions")]
643        pub contributed_extensions: Option<ContributedExtensionBlocks>,
644    }
645    impl HeaderInfo {
646        pub fn new(
647            psid: Psid,
648            generation_time: Option<Time64>,
649            expiry_time: Option<Time64>,
650            generation_location: Option<ThreeDLocation>,
651            p2pcd_learning_request: Option<HashedId3>,
652            missing_crl_identifier: Option<MissingCrlIdentifier>,
653            encryption_key: Option<EncryptionKey>,
654            inline_p2pcd_request: Option<SequenceOfHashedId3>,
655            requested_certificate: Option<Certificate>,
656            pdu_functional_type: Option<PduFunctionalType>,
657            contributed_extensions: Option<ContributedExtensionBlocks>,
658        ) -> Self {
659            Self {
660                psid,
661                generation_time,
662                expiry_time,
663                generation_location,
664                p2pcd_learning_request,
665                missing_crl_identifier,
666                encryption_key,
667                inline_p2pcd_request,
668                requested_certificate,
669                pdu_functional_type,
670                contributed_extensions,
671            }
672        }
673    }
674    #[doc = "*"]
675    #[doc = " * @brief This is an integer used to identify a HeaderInfo extension"]
676    #[doc = " * contributing organization. In this version of this standard two values are"]
677    #[doc = " * defined: "]
678    #[doc = " *   - ieee1609OriginatingExtensionId indicating extensions originating with "]
679    #[doc = " * IEEE Std 1609."]
680    #[doc = " *   - etsiOriginatingExtensionId indicating extensions originating with "]
681    #[doc = " * ETSI TC ITS."]
682    #[doc = " "]
683    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
684    #[rasn(delegate, value("0..=255"))]
685    pub struct HeaderInfoContributorId(pub u8);
686    #[doc = "*"]
687    #[doc = " * @brief This structure uses the parameterized type Extension to define an "]
688    #[doc = " * Ieee1609ContributedHeaderInfoExtension as an open Extension Content field "]
689    #[doc = " * identified by an extension identifier. The extension identifier value is "]
690    #[doc = " * unique to extensions defined by ETSI and need not be unique among all "]
691    #[doc = " * extension identifier values defined by all contributing organizations."]
692    #[doc = " "]
693    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
694    #[rasn(automatic_tags)]
695    pub struct Ieee1609ContributedHeaderInfoExtension {
696        pub id: ExtId,
697        pub content: OctetString,
698    }
699    impl Ieee1609ContributedHeaderInfoExtension {
700        pub fn new(id: ExtId, content: OctetString) -> Self {
701            Self { id, content }
702        }
703    }
704    #[doc = "*"]
705    #[doc = " * @brief In this structure:"]
706    #[doc = " *"]
707    #[doc = " * @param unsecuredData: indicates that the content is an OCTET STRING to be"]
708    #[doc = " * consumed outside the SDS."]
709    #[doc = " *"]
710    #[doc = " * @param signedData: indicates that the content has been signed according to"]
711    #[doc = " * this standard."]
712    #[doc = " *"]
713    #[doc = " * @param encryptedData: indicates that the content has been encrypted"]
714    #[doc = " * according to this standard."]
715    #[doc = " *"]
716    #[doc = " * @param signedCertificateRequest: indicates that the content is a "]
717    #[doc = " * certificate request signed by an IEEE 1609.2 certificate or self-signed."]
718    #[doc = " *"]
719    #[doc = " * @param signedX509CertificateRequest: indicates that the content is a "]
720    #[doc = " * certificate request signed by an ITU-T X.509 certificate."]
721    #[doc = " *"]
722    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
723    #[doc = " * for the relevant operations specified in 6.1.2 if it is of type signedData."]
724    #[doc = " * The canonicalization applies to the SignedData."]
725    #[doc = " "]
726    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
727    #[rasn(choice, automatic_tags)]
728    #[non_exhaustive]
729    pub enum Ieee1609Dot2Content {
730        unsecuredData(Opaque),
731        signedData(SignedData),
732        encryptedData(EncryptedData),
733        signedCertificateRequest(Opaque),
734        #[rasn(extension_addition)]
735        signedX509CertificateRequest(Opaque),
736    }
737    #[doc = "***************************************************************************"]
738    #[doc = "                               Secured Data                                "]
739    #[doc = "***************************************************************************"]
740    #[doc = "*"]
741    #[doc = " * @brief This data type is used to contain the other data types in this"]
742    #[doc = " * clause. The fields in the Ieee1609Dot2Data have the following meanings:"]
743    #[doc = " *"]
744    #[doc = " * @param protocolVersion: contains the current version of the protocol. The"]
745    #[doc = " * version specified in this standard is version 3, represented by the"]
746    #[doc = " * integer 3. There are no major or minor version numbers."]
747    #[doc = " *"]
748    #[doc = " * @param content: contains the content in the form of an Ieee1609Dot2Content."]
749    #[doc = " *"]
750    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
751    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
752    #[doc = " * applies to the Ieee1609Dot2Content."]
753    #[doc = " "]
754    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
755    #[rasn(automatic_tags)]
756    pub struct Ieee1609Dot2Data {
757        #[rasn(value("3"), identifier = "protocolVersion")]
758        pub protocol_version: Uint8,
759        pub content: Ieee1609Dot2Content,
760    }
761    impl Ieee1609Dot2Data {
762        pub fn new(protocol_version: Uint8, content: Ieee1609Dot2Content) -> Self {
763            Self {
764                protocol_version,
765                content,
766            }
767        }
768    }
769    #[doc = "*"]
770    #[doc = " * @brief This is an integer used to identify an "]
771    #[doc = " * Ieee1609ContributedHeaderInfoExtension."]
772    #[doc = " "]
773    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
774    #[rasn(delegate)]
775    pub struct Ieee1609HeaderInfoExtensionId(pub ExtId);
776    #[doc = "*"]
777    #[doc = " * @brief This is a profile of the CertificateBase structure providing all"]
778    #[doc = " * the fields necessary for an implicit certificate, and no others."]
779    #[doc = " "]
780    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
781    #[rasn(delegate)]
782    pub struct ImplicitCertificate(pub CertificateBase);
783    #[doc = "*"]
784    #[doc = " * @brief This structure allows the recipient of a certificate to determine"]
785    #[doc = " * which keying material to use to authenticate the certificate."]
786    #[doc = " *"]
787    #[doc = " * If the choice indicated is sha256AndDigest, sha384AndDigest, or "]
788    #[doc = " * sm3AndDigest:"]
789    #[doc = " *   - The structure contains the HashedId8 of the issuing certificate. The "]
790    #[doc = " * HashedId8 is calculated with the whole-certificate hash algorithm, "]
791    #[doc = " * determined as described in 6.4.3, applied to the COER-encoded certificate, "]
792    #[doc = " * canonicalized as defined in the definition of Certificate. "]
793    #[doc = " *   - The hash algorithm to be used to generate the hash of the certificate "]
794    #[doc = " * for verification is SHA-256 (in the case of sha256AndDigest), SM3 (in the "]
795    #[doc = " * case of sm3AndDigest) or SHA-384 (in the case of sha384AndDigest)."]
796    #[doc = " *   - The certificate is to be verified with the public key of the"]
797    #[doc = " * indicated issuing certificate."]
798    #[doc = " *"]
799    #[doc = " * If the choice indicated is self:"]
800    #[doc = " *   - The structure indicates what hash algorithm is to be used to generate"]
801    #[doc = " * the hash of the certificate for verification."]
802    #[doc = " *   - The certificate is to be verified with the public key indicated by"]
803    #[doc = " * the verifyKeyIndicator field in theToBeSignedCertificate."]
804    #[doc = " *"]
805    #[doc = " * @note Critical information fields: If present, this is a critical"]
806    #[doc = " * information field as defined in 5.2.5. An implementation that does not"]
807    #[doc = " * recognize the indicated CHOICE for this type when verifying a signed SPDU"]
808    #[doc = " * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, "]
809    #[doc = " * that is, it is invalid in the sense that its validity cannot be "]
810    #[doc = " * established."]
811    #[doc = " "]
812    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
813    #[rasn(choice, automatic_tags)]
814    #[non_exhaustive]
815    pub enum IssuerIdentifier {
816        sha256AndDigest(HashedId8),
817        #[rasn(identifier = "self")]
818        R_self(HashAlgorithm),
819        #[rasn(extension_addition)]
820        sha384AndDigest(HashedId8),
821        #[rasn(extension_addition)]
822        sm3AndDigest(HashedId8),
823    }
824    #[doc = "*"]
825    #[doc = " * @brief This structure contains information that is matched against"]
826    #[doc = " * information obtained from a linkage ID-based CRL to determine whether the"]
827    #[doc = " * containing certificate has been revoked. See 5.1.3.4 and 7.3 for details"]
828    #[doc = " * of use."]
829    #[doc = " "]
830    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
831    #[rasn(automatic_tags)]
832    pub struct LinkageData {
833        #[rasn(identifier = "iCert")]
834        pub i_cert: IValue,
835        #[rasn(identifier = "linkage-value")]
836        pub linkage_value: LinkageValue,
837        #[rasn(identifier = "group-linkage-value")]
838        pub group_linkage_value: Option<GroupLinkageValue>,
839    }
840    impl LinkageData {
841        pub fn new(
842            i_cert: IValue,
843            linkage_value: LinkageValue,
844            group_linkage_value: Option<GroupLinkageValue>,
845        ) -> Self {
846            Self {
847                i_cert,
848                linkage_value,
849                group_linkage_value,
850            }
851        }
852    }
853    #[doc = "*"]
854    #[doc = " * @brief This structure may be used to request a CRL that the SSME knows to"]
855    #[doc = " * have been issued and has not yet received. It is provided for future use"]
856    #[doc = " * and its use is not defined in this version of this standard."]
857    #[doc = " *"]
858    #[doc = " * @param cracaId: is the HashedId3 of the CRACA, as defined in 5.1.3. The "]
859    #[doc = " * HashedId3 is calculated with the whole-certificate hash algorithm, "]
860    #[doc = " * determined as described in 6.4.3, applied to the COER-encoded certificate,"]
861    #[doc = " * canonicalized as defined in the definition of Certificate."]
862    #[doc = " *"]
863    #[doc = " * @param crlSeries: is the requested CRL Series value. See 5.1.3 for more"]
864    #[doc = " * information."]
865    #[doc = " "]
866    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
867    #[rasn(automatic_tags)]
868    #[non_exhaustive]
869    pub struct MissingCrlIdentifier {
870        #[rasn(identifier = "cracaId")]
871        pub craca_id: HashedId3,
872        #[rasn(identifier = "crlSeries")]
873        pub crl_series: CrlSeries,
874    }
875    impl MissingCrlIdentifier {
876        pub fn new(craca_id: HashedId3, crl_series: CrlSeries) -> Self {
877            Self {
878                craca_id,
879                crl_series,
880            }
881        }
882    }
883    #[doc = "*"]
884    #[doc = " * @brief This data structure encapsulates an encrypted ciphertext for any "]
885    #[doc = " * symmetric algorithm with 128-bit blocks in CCM mode. The ciphertext is "]
886    #[doc = " * 16 bytes longer than the corresponding plaintext due to the inclusion of "]
887    #[doc = " * the message authentication code (MAC). The plaintext resulting from a "]
888    #[doc = " * correct decryption of the ciphertext is either a COER-encoded "]
889    #[doc = " * Ieee1609Dot2Data structure (see 6.3.41), or a 16-byte symmetric key "]
890    #[doc = " * (see 6.3.44)."]
891    #[doc = " *"]
892    #[doc = " * The ciphertext is 16 bytes longer than the corresponding plaintext."]
893    #[doc = " *"]
894    #[doc = " * The plaintext resulting from a correct decryption of the"]
895    #[doc = " * ciphertext is a COER-encoded Ieee1609Dot2Data structure."]
896    #[doc = " *"]
897    #[doc = " * @param nonce: contains the nonce N as specified in 5.3.8."]
898    #[doc = " *"]
899    #[doc = " * @param ccmCiphertext: contains the ciphertext C as specified in 5.3.8."]
900    #[doc = " *"]
901    #[doc = " * @note In the name of this structure, \"One28\" indicates that the "]
902    #[doc = " * symmetric cipher block size is 128 bits. It happens to also be the case "]
903    #[doc = " * that the keys used for both AES-128-CCM and SM4-CCM are also 128 bits long. "]
904    #[doc = " * This is, however, not what �One28� refers to. Since the cipher is used in "]
905    #[doc = " * counter mode, i.e., as a stream cipher, the fact that that block size is 128"]
906    #[doc = " * bits affects only the size of the MAC and does not affect the size of the"]
907    #[doc = " * raw ciphertext."]
908    #[doc = " "]
909    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
910    #[rasn(automatic_tags)]
911    pub struct One28BitCcmCiphertext {
912        #[rasn(size("12"))]
913        pub nonce: OctetString,
914        #[rasn(identifier = "ccmCiphertext")]
915        pub ccm_ciphertext: Opaque,
916    }
917    impl One28BitCcmCiphertext {
918        pub fn new(nonce: OctetString, ccm_ciphertext: Opaque) -> Self {
919            Self {
920                nonce,
921                ccm_ciphertext,
922            }
923        }
924    }
925    #[doc = "*"]
926    #[doc = " * @brief This type is the AppExtension used to identify an operating "]
927    #[doc = " * organization. See 5.2.6.6.7.2 for discussion of how the"]
928    #[doc = " * OperatingOrganizationId can be integrated into the SPDU payload by an"]
929    #[doc = " * SDEE specifier."]
930    #[doc = " *"]
931    #[doc = " * A certificate may have an OperatingOrganizationId associated with it even if"]
932    #[doc = " * the certificate does not contain an OperatingOrganizationId field. If the"]
933    #[doc = " * certificate does not contain an OperatingOrganizationId field, the"]
934    #[doc = " * associated OperatingOrganizationId is determined as follows:"]
935    #[doc = " *"]
936    #[doc = " *   - If the certificate is self-signed, that is, the choice indicated by the"]
937    #[doc = " * issuer field in the enclosing certificate structure is self, the"]
938    #[doc = " * certificate has no OperatingOrganizationId associated with it."]
939    #[doc = " *"]
940    #[doc = " *   -  Otherwise, the certificate has the same OperatingOrganizationId as"]
941    #[doc = " * the certificate that issued it."]
942    #[doc = " *"]
943    #[doc = " * The above algorithm is applied recursively, i.e. if"]
944    #[doc = " * OperatingOrganizationId is omitted from the issuing certificate, then"]
945    #[doc = " * the issuing certificate of that certificate is inspected to determine if"]
946    #[doc = " * OperatingOrganizationId is present, and so on."]
947    #[doc = " *"]
948    #[doc = " * Consistency with SPDU payload. As discussed in 5.2.6.6.7.2, the SPDU payload"]
949    #[doc = " * design might or might not include OperatingOrganizationId material. "]
950    #[doc = " *"]
951    #[doc = " * If OperatingOrganizationId material appears in the SPDU payload, then the"]
952    #[doc = " * SDEE specification is expected to state that consistency is required between"]
953    #[doc = " * the payload and the certificate (although, as discussed in 5.2.6.6.7.2, this"]
954    #[doc = " * approach is not recommended)."]
955    #[doc = " *"]
956    #[doc = " * If consistency is required between the OperatingOrganizationID"]
957    #[doc = " * and operating organization information represented by an OBJECT"]
958    #[doc = " * IDENTIFIER in the SPDU payload, then the SDEE specification for that SPDU is"]
959    #[doc = " * required to specify how the SPDU can be used to determine an OBJECT"]
960    #[doc = " * IDENTIFIER of the same length as the OperatingOrganizationId in the"]
961    #[doc = " * certificate (e.g., by including the full OBJECT IDENTIFIER in the SPDU, or"]
962    #[doc = " * by including a RELATIVE-OID with clear instructions about how a full OBJECT"]
963    #[doc = " * IDENTIFIER can be obtained from the RELATIVE-OID, or by truncating an"]
964    #[doc = " * OBJECT IDENTIFIER from the message to be the same length as the OBJECT"]
965    #[doc = " * IDENTIFIER in the certificate). The SPDU is then consistent with this type"]
966    #[doc = " * if the OBJECT IDENTIFIER determined from the SPDU is identical to the OBJECT"]
967    #[doc = " * IDENTIFIER contained in this field."]
968    #[doc = " *"]
969    #[doc = " * Consistency with issuing certificate. This AppExtension does not have"]
970    #[doc = " * consistency conditions with a corresponding CertIssueExtension. It can"]
971    #[doc = " * appear in a certificate issued by any CA."]
972    #[doc = " *"]
973    #[doc = " * Consistency with certificate request signing certificate. This AppExtension"]
974    #[doc = " * does not have consistency conditions with a corresponding"]
975    #[doc = " * CertRequestExtension. It can appear in a certificate request signed by any"]
976    #[doc = " * certificate containing certRequestPermissions, i.e. by any enrollment"]
977    #[doc = " * certificate."]
978    #[doc = " "]
979    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
980    #[rasn(delegate)]
981    pub struct OperatingOrganizationId(pub ObjectIdentifier);
982    #[doc = "*"]
983    #[doc = " * @brief This data structure contains the following fields:"]
984    #[doc = " *"]
985    #[doc = " * @param recipientId: contains the hash of the container for the encryption"]
986    #[doc = " * public key as specified in the definition of RecipientInfo. Specifically,"]
987    #[doc = " * depending on the choice indicated by the containing RecipientInfo structure:"]
988    #[doc = " *   - If the containing RecipientInfo structure indicates certRecipInfo,"]
989    #[doc = " * this field contains the HashedId8 of the certificate. The HashedId8 is"]
990    #[doc = " * calculated with the whole-certificate hash algorithm, determined as"]
991    #[doc = " * described in 6.4.3, applied to the COER-encoded certificate, canonicalized"]
992    #[doc = " * as defined in the definition of Certificate."]
993    #[doc = " *   - If the containing RecipientInfo structure indicates "]
994    #[doc = " * signedDataRecipInfo, this field contains the HashedId8 of the "]
995    #[doc = " * Ieee1609Dot2Data of type signedData that contained the encryption key, "]
996    #[doc = " * with that Ieee��1609�Dot2��Data canonicalized per 6.3.4. The HashedId8 is "]
997    #[doc = " * calculated with the hash algorithm determined as specified in 5.3.9.5."]
998    #[doc = " *   - If the containing RecipientInfo structure indicates rekRecipInfo, this "]
999    #[doc = " * field contains the HashedId8 of the COER encoding of a PublicEncryptionKey "]
1000    #[doc = " * structure containing the response encryption key. The HashedId8 is "]
1001    #[doc = " * calculated with the hash algorithm determined as specified in 5.3.9.5."]
1002    #[doc = " *"]
1003    #[doc = " * @param encKey: contains the encrypted data encryption key, where the data "]
1004    #[doc = " * encryption key is input to the data encryption key encryption process with "]
1005    #[doc = " * no headers, encapsulation, or length indication. "]
1006    #[doc = " "]
1007    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1008    #[rasn(automatic_tags)]
1009    pub struct PKRecipientInfo {
1010        #[rasn(identifier = "recipientId")]
1011        pub recipient_id: HashedId8,
1012        #[rasn(identifier = "encKey")]
1013        pub enc_key: EncryptedDataEncryptionKey,
1014    }
1015    impl PKRecipientInfo {
1016        pub fn new(recipient_id: HashedId8, enc_key: EncryptedDataEncryptionKey) -> Self {
1017            Self {
1018                recipient_id,
1019                enc_key,
1020            }
1021        }
1022    }
1023    #[doc = "*"]
1024    #[doc = " * @brief This data structure identifies the functional entity that is "]
1025    #[doc = " * intended to consume an SPDU, for the case where that functional entity is "]
1026    #[doc = " * not an application process, and are instead security support services for an"]
1027    #[doc = " * application process. Further details and the intended use of this field are "]
1028    #[doc = " * defined in ISO 21177 [B20]."]
1029    #[doc = " *"]
1030    #[doc = " * @param tlsHandshake: indicates that the Signed SPDU is not to be directly "]
1031    #[doc = " * consumed as an application PDU and is to be used to provide information "]
1032    #[doc = " * about the holder�s permissions to a Transport Layer Security (TLS) "]
1033    #[doc = " * (IETF 5246 [B15], IETF 8446 [B16]) handshake process operating to secure "]
1034    #[doc = " * communications to an application process. See IETF [B15] and ISO 21177 "]
1035    #[doc = " * [B20] for further information."]
1036    #[doc = " *"]
1037    #[doc = " * @param iso21177ExtendedAuth: indicates that the Signed SPDU is not to be "]
1038    #[doc = " * directly consumed as an application PDU and is to be used to provide "]
1039    #[doc = " * additional information about the holder�s permissions to the ISO 21177 "]
1040    #[doc = " * Security Subsystem for an application process. See ISO 21177 [B20] for "]
1041    #[doc = " * further information."]
1042    #[doc = " *"]
1043    #[doc = " * @param iso21177SessionExtension: indicates that the Signed SPDU is not to "]
1044    #[doc = " * be directly consumed as an application PDU and is to be used to extend an "]
1045    #[doc = " * existing ISO 21177 secure session. This enables a secure session to "]
1046    #[doc = " * persist beyond the lifetime of the certificates used to establish that "]
1047    #[doc = " * session."]
1048    #[doc = " "]
1049    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1050    #[rasn(delegate, value("0..=255"))]
1051    pub struct PduFunctionalType(pub u8);
1052    #[doc = "*"]
1053    #[doc = " * @brief This data structure is used to indicate a symmetric key that may "]
1054    #[doc = " * be used directly to decrypt a SymmetricCiphertext. It consists of the "]
1055    #[doc = " * low-order 8 bytes of the hash of the COER encoding of a "]
1056    #[doc = " * SymmetricEncryptionKey structure containing the symmetric key in question. "]
1057    #[doc = " * The HashedId8 is calculated with the hash algorithm determined as "]
1058    #[doc = " * specified in 5.3.9.3. The symmetric key may be established by any "]
1059    #[doc = " * appropriate means agreed by the two parties to the exchange."]
1060    #[doc = " "]
1061    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1062    #[rasn(delegate)]
1063    pub struct PreSharedKeyRecipientInfo(pub HashedId8);
1064    #[doc = "*"]
1065    #[doc = " * @brief This structure states the permissions that a certificate holder has"]
1066    #[doc = " * with respect to issuing and requesting certificates for a particular set"]
1067    #[doc = " * of PSIDs. For examples, see D.5.3 and D.5.4."]
1068    #[doc = " *"]
1069    #[doc = " * @param subjectPermissions: indicates PSIDs and SSP Ranges covered by this"]
1070    #[doc = " * field."]
1071    #[doc = " *"]
1072    #[doc = " * @param minChainLength: and chainLengthRange indicate how long the"]
1073    #[doc = " * certificate chain from this certificate to the end-entity certificate is"]
1074    #[doc = " * permitted to be. As specified in 5.1.2.1, the length of the certificate"]
1075    #[doc = " * chain is the number of certificates \"below\" this certificate in the chain,"]
1076    #[doc = " * down to and including the end-entity certificate. The length is permitted"]
1077    #[doc = " * to be (a) greater than or equal to minChainLength certificates and (b)"]
1078    #[doc = " * less than or equal to minChainLength + chainLengthRange certificates. A"]
1079    #[doc = " * value of 0 for minChainLength is not permitted when this type appears in"]
1080    #[doc = " * the certIssuePermissions field of a ToBeSignedCertificate; a certificate"]
1081    #[doc = " * that has a value of 0 for this field is invalid. The value -1 for"]
1082    #[doc = " * chainLengthRange is a special case: if the value of chainLengthRange is -1"]
1083    #[doc = " * it indicates that the certificate chain may be any length equal to or"]
1084    #[doc = " * greater than minChainLength. See the examples below for further discussion."]
1085    #[doc = " *"]
1086    #[doc = " * @param eeType: takes one or more of the values app and enroll and indicates"]
1087    #[doc = " * the type of certificates or requests that this instance of"]
1088    #[doc = " * PsidGroupPermissions in the certificate is entitled to authorize. "]
1089    #[doc = " * Different instances of PsidGroupPermissions within a ToBeSignedCertificate"]
1090    #[doc = " * may have different values for eeType."]
1091    #[doc = " *   - If this field indicates app, the chain is allowed to end in an "]
1092    #[doc = " * authorization certificate, i.e., a certificate in which these permissions "]
1093    #[doc = " * appear in an appPermissions field (in other words, if the field does not "]
1094    #[doc = " * indicate app and the chain ends in an authorization certificate, the "]
1095    #[doc = " * chain shall be considered invalid)."]
1096    #[doc = " *   - If this field indicates enroll, the chain is allowed to end in an "]
1097    #[doc = " * enrollment certificate, i.e., a certificate in which these permissions "]
1098    #[doc = " * appear in a certRequestPermissions permissions field (in other words, if the "]
1099    #[doc = " * field does not indicate enroll and the chain ends in an enrollment "]
1100    #[doc = " * certificate, the chain shall be considered invalid)."]
1101    #[doc = " "]
1102    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1103    #[rasn(automatic_tags)]
1104    pub struct PsidGroupPermissions {
1105        #[rasn(identifier = "subjectPermissions")]
1106        pub subject_permissions: SubjectPermissions,
1107        #[rasn(
1108            default = "psid_group_permissions_min_chain_length_default",
1109            identifier = "minChainLength"
1110        )]
1111        pub min_chain_length: Integer,
1112        #[rasn(
1113            default = "psid_group_permissions_chain_length_range_default",
1114            identifier = "chainLengthRange"
1115        )]
1116        pub chain_length_range: Integer,
1117        #[rasn(
1118            default = "psid_group_permissions_ee_type_default",
1119            identifier = "eeType"
1120        )]
1121        pub ee_type: EndEntityType,
1122    }
1123    impl PsidGroupPermissions {
1124        pub fn new(
1125            subject_permissions: SubjectPermissions,
1126            min_chain_length: Integer,
1127            chain_length_range: Integer,
1128            ee_type: EndEntityType,
1129        ) -> Self {
1130            Self {
1131                subject_permissions,
1132                min_chain_length,
1133                chain_length_range,
1134                ee_type,
1135            }
1136        }
1137    }
1138    fn psid_group_permissions_min_chain_length_default() -> Integer {
1139        Integer::from(1i128)
1140    }
1141    fn psid_group_permissions_chain_length_range_default() -> Integer {
1142        Integer::from(0i128)
1143    }
1144    fn psid_group_permissions_ee_type_default() -> EndEntityType {
1145        let mut bits = FixedBitString::<8usize>::default();
1146        bits.set(0, true);
1147        EndEntityType(bits)
1148    }
1149    #[doc = "*"]
1150    #[doc = " * @brief This data structure is used to transfer the data encryption key to"]
1151    #[doc = " * an individual recipient of an EncryptedData. The option pskRecipInfo is"]
1152    #[doc = " * selected if the EncryptedData was encrypted using the static encryption"]
1153    #[doc = " * key approach specified in 5.3.4. The other options are selected if the"]
1154    #[doc = " * EncryptedData was encrypted using the ephemeral encryption key approach"]
1155    #[doc = " * specified in 5.3.4. The meanings of the choices are as follows:"]
1156    #[doc = " *"]
1157    #[doc = " * @param pskRecipInfo: The data was encrypted directly using a pre-shared "]
1158    #[doc = " * symmetric key."]
1159    #[doc = " *"]
1160    #[doc = " * @param symmRecipInfo: The data was encrypted with a data encryption key,"]
1161    #[doc = " * and the data encryption key was encrypted using a symmetric key."]
1162    #[doc = " *"]
1163    #[doc = " * @param certRecipInfo: The data was encrypted with a data encryption key, "]
1164    #[doc = " * the data encryption key was encrypted using a public key encryption scheme,"]
1165    #[doc = " * where the public encryption key was obtained from a certificate. In this "]
1166    #[doc = " * case, the parameter P1 to ECIES as defined in 5.3.5 is the hash of the "]
1167    #[doc = " * certificate, calculated with the whole-certificate hash algorithm, "]
1168    #[doc = " * determined as described in 6.4.3, applied to the COER-encoded certificate, "]
1169    #[doc = " * canonicalized as defined in the definition of Certificate."]
1170    #[doc = " *"]
1171    #[doc = " * @note If the encryption algorithm is SM2, there is no equivalent of the "]
1172    #[doc = " * parameter P1 and so no input to the encryption process that uses the hash"]
1173    #[doc = " * of the certificate."]
1174    #[doc = " *"]
1175    #[doc = " * @param signedDataRecipInfo: The data was encrypted with a data encryption "]
1176    #[doc = " * key, the data encryption key was encrypted using a public key encryption "]
1177    #[doc = " * scheme, where the public encryption key was obtained as the public response "]
1178    #[doc = " * encryption key from a SignedData. In this case, if ECIES is the encryption "]
1179    #[doc = " * algorithm, then the parameter P1 to ECIES as defined in 5.3.5 is the "]
1180    #[doc = " * SHA-256 hash of the Ieee1609Dot2Data of type signedData containing the "]
1181    #[doc = " * response encryption key, canonicalized as defined in the definition of "]
1182    #[doc = " * Ieee1609Dot2Data."]
1183    #[doc = " *"]
1184    #[doc = " * @note If the encryption algorithm is SM2, there is no equivalent of the "]
1185    #[doc = " * parameter P1 and so no input to the encryption process that uses the hash"]
1186    #[doc = " * of the Ieee1609Dot2Data."]
1187    #[doc = " *"]
1188    #[doc = " * @param rekRecipInfo: The data was encrypted with a data encryption key, "]
1189    #[doc = " * the data encryption key was encrypted using a public key encryption scheme,"]
1190    #[doc = " * where the public encryption key was not obtained from a Signed-Data or a "]
1191    #[doc = " * certificate. In this case, the SDEE specification is expected to specify "]
1192    #[doc = " * how the public key is obtained, and if ECIES is the encryption algorithm, "]
1193    #[doc = " * then the parameter P1 to ECIES as defined in 5.3.5 is the hash of the "]
1194    #[doc = " * empty string."]
1195    #[doc = " *"]
1196    #[doc = " * @note If the encryption algorithm is SM2, there is no equivalent of the "]
1197    #[doc = " * parameter P1 and so no input to the encryption process that uses the hash "]
1198    #[doc = " * of the empty string."]
1199    #[doc = " *"]
1200    #[doc = " * See C.8 for guidance on when it may be appropriate to use each of these"]
1201    #[doc = " * approaches."]
1202    #[doc = " *"]
1203    #[doc = " * @note The material input to encryption is the bytes of the encryption key "]
1204    #[doc = " * with no headers, encapsulation, or length indication. Contrast this to "]
1205    #[doc = " * encryption of data, where the data is encapsulated in an Ieee1609Dot2Data."]
1206    #[doc = " "]
1207    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1208    #[rasn(choice, automatic_tags)]
1209    pub enum RecipientInfo {
1210        pskRecipInfo(PreSharedKeyRecipientInfo),
1211        symmRecipInfo(SymmRecipientInfo),
1212        certRecipInfo(PKRecipientInfo),
1213        signedDataRecipInfo(PKRecipientInfo),
1214        rekRecipInfo(PKRecipientInfo),
1215    }
1216    #[doc = "*"]
1217    #[doc = " * @brief This structure contains any AppExtensions that apply to the "]
1218    #[doc = " * certificate holder. As specified in 5.2.4.2.3, each individual "]
1219    #[doc = " * AppExtension type is associated with consistency conditions, specific to "]
1220    #[doc = " * that extension, that govern its consistency with SPDUs signed by the "]
1221    #[doc = " * certificate holder and with the CertIssueExtensions in the CA certificates "]
1222    #[doc = " * in that certificate holder�s chain. Those consistency conditions are "]
1223    #[doc = " * specified for each individual AppExtension below."]
1224    #[doc = " "]
1225    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1226    #[rasn(delegate, size("1.."))]
1227    pub struct SequenceOfAppExtensions(pub SequenceOf<AppExtension>);
1228    #[doc = "*"]
1229    #[doc = " * @brief This field contains any CertIssueExtensions that apply to the "]
1230    #[doc = " * certificate holder. As specified in 5.2.4.2.3, each individual "]
1231    #[doc = " * CertIssueExtension type is associated with consistency conditions, "]
1232    #[doc = " * specific to that extension, that govern its consistency with "]
1233    #[doc = " * AppExtensions in certificates issued by the certificate holder and with "]
1234    #[doc = " * the CertIssueExtensions in the CA certificates in that certificate "]
1235    #[doc = " * holder�s chain. Those consistency conditions are specified for each "]
1236    #[doc = " * individual CertIssueExtension below."]
1237    #[doc = " "]
1238    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1239    #[rasn(delegate, size("1.."))]
1240    pub struct SequenceOfCertIssueExtensions(pub SequenceOf<CertIssueExtension>);
1241    #[doc = "*"]
1242    #[doc = " * @brief This field contains any CertRequestExtensions that apply to the "]
1243    #[doc = " * certificate holder. As specified in 5.2.4.2.3, each individual "]
1244    #[doc = " * CertRequestExtension type is associated with consistency conditions, "]
1245    #[doc = " * specific to that extension, that govern its consistency with "]
1246    #[doc = " * AppExtensions in certificates issued by the certificate holder and with "]
1247    #[doc = " * the CertRequestExtensions in the CA certificates in that certificate "]
1248    #[doc = " * holder�s chain. Those consistency conditions are specified for each "]
1249    #[doc = " * individual CertRequestExtension below."]
1250    #[doc = " "]
1251    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1252    #[rasn(delegate, size("1.."))]
1253    pub struct SequenceOfCertRequestExtensions(pub SequenceOf<CertRequestExtension>);
1254    #[doc = "*"]
1255    #[doc = " * @brief This type is used for clarity of definitions."]
1256    #[doc = " "]
1257    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1258    #[rasn(delegate)]
1259    pub struct SequenceOfCertificate(pub SequenceOf<Certificate>);
1260    #[doc = "*"]
1261    #[doc = " * @brief This type is used for clarity of definitions."]
1262    #[doc = " "]
1263    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1264    #[rasn(delegate)]
1265    pub struct SequenceOfPsidGroupPermissions(pub SequenceOf<PsidGroupPermissions>);
1266    #[doc = "*"]
1267    #[doc = " * @brief This type is used for clarity of definitions."]
1268    #[doc = " "]
1269    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1270    #[rasn(delegate)]
1271    pub struct SequenceOfRecipientInfo(pub SequenceOf<RecipientInfo>);
1272    #[doc = "*"]
1273    #[doc = " * @brief In this structure:"]
1274    #[doc = " *"]
1275    #[doc = " * @param hashId: indicates the hash algorithm to be used to generate the hash"]
1276    #[doc = " * of the message for signing and verification."]
1277    #[doc = " *"]
1278    #[doc = " * @param tbsData: contains the data that is hashed as input to the signature."]
1279    #[doc = " *"]
1280    #[doc = " * @param signer: determines the keying material and hash algorithm used to"]
1281    #[doc = " * sign the data."]
1282    #[doc = " *"]
1283    #[doc = " * @param signature: contains the digital signature itself, calculated as"]
1284    #[doc = " * specified in 5.3.1."]
1285    #[doc = " *   - If signer indicates the choice self, then the signature calculation"]
1286    #[doc = " * is parameterized as follows:"]
1287    #[doc = " *     - Data input is equal to the COER encoding of the tbsData field"]
1288    #[doc = " * canonicalized according to the encoding considerations given in 6.3.6."]
1289    #[doc = " *     - Verification type is equal to self."]
1290    #[doc = " *     - Signer identifier input is equal to the empty string."]
1291    #[doc = " *   - If signer indicates certificate or digest, then the signature"]
1292    #[doc = " * calculation is parameterized as follows:"]
1293    #[doc = " *     - Data input is equal to the COER encoding of the tbsData field"]
1294    #[doc = " * canonicalized according to the encoding considerations given in 6.3.6."]
1295    #[doc = " *     - Verification type is equal to certificate."]
1296    #[doc = " *     - Signer identifier input equal to the COER-encoding of the"]
1297    #[doc = " * Certificate that is to be used to verify the SPDU, canonicalized according"]
1298    #[doc = " * to the encoding considerations given in 6.4.3."]
1299    #[doc = " *"]
1300    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
1301    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1302    #[doc = " * applies to the ToBeSignedData and the Signature."]
1303    #[doc = " "]
1304    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1305    #[rasn(automatic_tags)]
1306    pub struct SignedData {
1307        #[rasn(identifier = "hashId")]
1308        pub hash_id: HashAlgorithm,
1309        #[rasn(identifier = "tbsData")]
1310        pub tbs_data: ToBeSignedData,
1311        pub signer: SignerIdentifier,
1312        pub signature: Signature,
1313    }
1314    impl SignedData {
1315        pub fn new(
1316            hash_id: HashAlgorithm,
1317            tbs_data: ToBeSignedData,
1318            signer: SignerIdentifier,
1319            signature: Signature,
1320        ) -> Self {
1321            Self {
1322                hash_id,
1323                tbs_data,
1324                signer,
1325                signature,
1326            }
1327        }
1328    }
1329    #[doc = "*"]
1330    #[doc = " * @brief This structure contains the data payload of a ToBeSignedData. This "]
1331    #[doc = " * structure contains at least one of the optional elements, and may contain "]
1332    #[doc = " * more than one. See 5.2.4.3.4 for more details."]
1333    #[doc = " * The security profile in Annex C allows an implementation of this standard "]
1334    #[doc = " * to state which forms of SignedDataPayload are supported by that "]
1335    #[doc = " * implementation, and also how the signer and verifier are intended to obtain"]
1336    #[doc = " * the external data for hashing. The specification of an SDEE that uses "]
1337    #[doc = " * external data is expected to be explicit and unambiguous about how this "]
1338    #[doc = " * data is obtained and how it is formatted prior to processing by the hash "]
1339    #[doc = " * function."]
1340    #[doc = " *"]
1341    #[doc = " * @param data: contains data that is explicitly transported within the"]
1342    #[doc = " * structure."]
1343    #[doc = " *"]
1344    #[doc = " * @param extDataHash: contains the hash of data that is not explicitly "]
1345    #[doc = " * transported within the structure, and which the creator of the structure "]
1346    #[doc = " * wishes to cryptographically bind to the signature. "]
1347    #[doc = " *"]
1348    #[doc = " * @param omitted: indicates that there is data to be included in the hash"]
1349    #[doc = " * calculation for the signature that is not included in the SPDU, either in"]
1350    #[doc = " * data or by use of the extDataHash. The mechanism for including the omitted"]
1351    #[doc = " * data in the hash calculation is specified in 6.3.6."]
1352    #[doc = " *"]
1353    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
1354    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1355    #[doc = " * applies to the Ieee1609Dot2Data."]
1356    #[doc = " "]
1357    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1358    #[rasn(automatic_tags)]
1359    #[non_exhaustive]
1360    pub struct SignedDataPayload {
1361        pub data: Option<Ieee1609Dot2Data>,
1362        #[rasn(identifier = "extDataHash")]
1363        pub ext_data_hash: Option<HashedData>,
1364        #[rasn(extension_addition)]
1365        pub omitted: Option<()>,
1366    }
1367    impl SignedDataPayload {
1368        pub fn new(
1369            data: Option<Ieee1609Dot2Data>,
1370            ext_data_hash: Option<HashedData>,
1371            omitted: Option<()>,
1372        ) -> Self {
1373            Self {
1374                data,
1375                ext_data_hash,
1376                omitted,
1377            }
1378        }
1379    }
1380    #[doc = "*"]
1381    #[doc = " * @brief This structure allows the recipient of data to determine which"]
1382    #[doc = " * keying material to use to authenticate the data. It also indicates the"]
1383    #[doc = " * verification type to be used to generate the hash for verification, as"]
1384    #[doc = " * specified in 5.3.1."]
1385    #[doc = " *"]
1386    #[doc = " * @param digest: If the choice indicated is digest:"]
1387    #[doc = " *   - The structure contains the HashedId8 of the relevant certificate. The"]
1388    #[doc = " * HashedId8 is calculated with the whole-certificate hash algorithm,"]
1389    #[doc = " * determined as described in 6.4.3."]
1390    #[doc = " *   - The verification type is certificate and the certificate data"]
1391    #[doc = " * passed to the hash function as specified in 5.3.1 is the authorization"]
1392    #[doc = " * certificate."]
1393    #[doc = " *"]
1394    #[doc = " * @param certificate: If the choice indicated is certificate:"]
1395    #[doc = " *   - The structure contains one or more Certificate structures, in order"]
1396    #[doc = " * such that the first certificate is the authorization certificate and each"]
1397    #[doc = " * subsequent certificate is the issuer of the one before it. The certificate"]
1398    #[doc = " * chain may be of any length. It should not include the root CA certificate"]
1399    #[doc = " * (as the receiving SDS is assumed to know all valid root CAs already)."]
1400    #[doc = " *   - The verification type is certificate and the certificate data"]
1401    #[doc = " * passed to the hash function as specified in 5.3.1 is the authorization"]
1402    #[doc = " * certificate."]
1403    #[doc = " *"]
1404    #[doc = " * @param self: If the choice indicated is self:"]
1405    #[doc = " *   - The structure does not contain any data beyond the indication that"]
1406    #[doc = " * the choice value is self."]
1407    #[doc = " *   - The verification type is self-signed."]
1408    #[doc = " *"]
1409    #[doc = " * @note Critical information fields:"]
1410    #[doc = " *   - If present, this is a critical information field as defined in 5.2.6."]
1411    #[doc = " * An implementation that does not recognize the CHOICE value for this type"]
1412    #[doc = " * when verifying a signed SPDU shall indicate that the signed SPDU is invalid."]
1413    #[doc = " *   - If present, certificate is a critical information field as defined in"]
1414    #[doc = " * 5.2.6. An implementation that does not support the number of certificates"]
1415    #[doc = " * in certificate when verifying a signed SPDU shall indicate that the signed"]
1416    #[doc = " * SPDU is invalid. A compliant implementation shall support certificate"]
1417    #[doc = " * fields containing at least one certificate."]
1418    #[doc = " *"]
1419    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
1420    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1421    #[doc = " * applies to every Certificate in the certificate field."]
1422    #[doc = " "]
1423    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1424    #[rasn(choice, automatic_tags)]
1425    #[non_exhaustive]
1426    pub enum SignerIdentifier {
1427        digest(HashedId8),
1428        certificate(SequenceOfCertificate),
1429        #[rasn(identifier = "self")]
1430        R_self(()),
1431    }
1432    #[doc = "*"]
1433    #[doc = " * @brief This indicates the PSIDs and associated SSPs for which certificate"]
1434    #[doc = " * issuance or request permissions are granted by a PsidGroupPermissions"]
1435    #[doc = " * structure. If this takes the value explicit, the enclosing"]
1436    #[doc = " * PsidGroupPermissions structure grants certificate issuance or request"]
1437    #[doc = " * permissions for the indicated PSIDs and SSP Ranges. If this takes the"]
1438    #[doc = " * value all, the enclosing PsidGroupPermissions structure grants certificate"]
1439    #[doc = " * issuance or request permissions for all PSIDs not indicated by other"]
1440    #[doc = " * PsidGroupPermissions in the same certIssuePermissions or"]
1441    #[doc = " * certRequestPermissions field."]
1442    #[doc = " *"]
1443    #[doc = " * @note Critical information fields:"]
1444    #[doc = " *   - If present, this is a critical information field as defined in 5.2.6."]
1445    #[doc = " * An implementation that does not recognize the indicated CHOICE when"]
1446    #[doc = " * verifying a signed SPDU shall indicate that the signed SPDU is"]
1447    #[doc = " * invalidin the sense of 4.2.2.3.2, that is, it is invalid in the sense that"]
1448    #[doc = " * its validity cannot be established."]
1449    #[doc = " *   - If present, explicit is a critical information field as defined in"]
1450    #[doc = " * 5.2.6. An implementation that does not support the number of PsidSspRange"]
1451    #[doc = " * in explicit when verifying a signed SPDU shall indicate that the signed"]
1452    #[doc = " * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the "]
1453    #[doc = " * sense that its validity cannot be established. A conformant implementation"]
1454    #[doc = " * shall support explicit fields containing at least eight entries."]
1455    #[doc = " "]
1456    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1457    #[rasn(choice, automatic_tags)]
1458    #[non_exhaustive]
1459    pub enum SubjectPermissions {
1460        explicit(SequenceOfPsidSspRange),
1461        all(()),
1462    }
1463    #[doc = "*"]
1464    #[doc = " * @brief This data structure contains the following fields:"]
1465    #[doc = " *"]
1466    #[doc = " * @param recipientId: contains the hash of the symmetric key encryption key "]
1467    #[doc = " * that may be used to decrypt the data encryption key. It consists of the "]
1468    #[doc = " * low-order 8 bytes of the hash of the COER encoding of a "]
1469    #[doc = " * SymmetricEncryptionKey structure containing the symmetric key in question. "]
1470    #[doc = " * The HashedId8 is calculated with the hash algorithm determined as "]
1471    #[doc = " * specified in 5.3.9.4. The symmetric key may be established by any "]
1472    #[doc = " * appropriate means agreed by the two parties to the exchange."]
1473    #[doc = " *"]
1474    #[doc = " * @param encKey: contains the encrypted data encryption key within a "]
1475    #[doc = " * SymmetricCiphertext, where the data encryption key is input to the data "]
1476    #[doc = " * encryption key encryption process with no headers, encapsulation, or "]
1477    #[doc = " * length indication."]
1478    #[doc = " "]
1479    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1480    #[rasn(automatic_tags)]
1481    pub struct SymmRecipientInfo {
1482        #[rasn(identifier = "recipientId")]
1483        pub recipient_id: HashedId8,
1484        #[rasn(identifier = "encKey")]
1485        pub enc_key: SymmetricCiphertext,
1486    }
1487    impl SymmRecipientInfo {
1488        pub fn new(recipient_id: HashedId8, enc_key: SymmetricCiphertext) -> Self {
1489            Self {
1490                recipient_id,
1491                enc_key,
1492            }
1493        }
1494    }
1495    #[doc = "*"]
1496    #[doc = " * @brief This data structure encapsulates a ciphertext generated with an"]
1497    #[doc = " * approved symmetric algorithm."]
1498    #[doc = " *"]
1499    #[doc = " * @note Critical information fields: If present, this is a critical"]
1500    #[doc = " * information field as defined in 5.2.6. An implementation that does not"]
1501    #[doc = " * recognize the indicated CHOICE value for this type in an encrypted SPDU"]
1502    #[doc = " * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, "]
1503    #[doc = " * that is, it is invalid in the sense that its validity cannot be established."]
1504    #[doc = " "]
1505    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1506    #[rasn(choice, automatic_tags)]
1507    #[non_exhaustive]
1508    pub enum SymmetricCiphertext {
1509        aes128ccm(One28BitCcmCiphertext),
1510        #[rasn(extension_addition)]
1511        sm4Ccm(One28BitCcmCiphertext),
1512    }
1513    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1514    #[rasn(delegate)]
1515    pub struct TestCertificate(pub Certificate);
1516    #[doc = "*"]
1517    #[doc = " * @brief The fields in the ToBeSignedCertificate structure have the"]
1518    #[doc = " * following meaning:"]
1519    #[doc = " *"]
1520    #[doc = " * In other words, for implicit certificates, the value H (CertU) in SEC 4,"]
1521    #[doc = " * section 3, is for purposes of this standard taken to be H [H"]
1522    #[doc = " * (canonicalized ToBeSignedCertificate from the subordinate certificate) ||"]
1523    #[doc = " * H (entirety of issuer Certificate)]. See 5.3.2 for further discussion,"]
1524    #[doc = " * including material differences between this standard and SEC 4 regarding"]
1525    #[doc = " * how the hash function output is converted from a bit string to an integer."]
1526    #[doc = " *"]
1527    #[doc = " * @param id: contains information that is used to identify the certificate"]
1528    #[doc = " * holder if necessary."]
1529    #[doc = " *"]
1530    #[doc = " * @param cracaId: identifies the Certificate Revocation Authorization CA"]
1531    #[doc = " * (CRACA) responsible for certificate revocation lists (CRLs) on which this"]
1532    #[doc = " * certificate might appear. Use of the cracaId is specified in 5.1.3. The"]
1533    #[doc = " * HashedId3 is calculated with the whole-certificate hash algorithm,"]
1534    #[doc = " * determined as described in 6.4.3, applied to the COER-encoded certificate, "]
1535    #[doc = " * canonicalized as defined in the definition of Certificate."]
1536    #[doc = " *"]
1537    #[doc = " * @param crlSeries: represents the CRL series relevant to a particular"]
1538    #[doc = " * Certificate Revocation Authorization CA (CRACA) on which the certificate"]
1539    #[doc = " * might appear. Use of this field is specified in 5.1.3."]
1540    #[doc = " *"]
1541    #[doc = " * @param validityPeriod: contains the validity period of the certificate."]
1542    #[doc = " *"]
1543    #[doc = " * @param region: if present, indicates the validity region of the"]
1544    #[doc = " * certificate. If it is omitted the validity region is determined as follows:"]
1545    #[doc = " *   - If the enclosing certificate is self-signed, i.e., the choice indicated"]
1546    #[doc = " * by the issuer field in the enclosing certificate structure is self, the"]
1547    #[doc = " * certificate is valid worldwide."]
1548    #[doc = " *   - Otherwise, the certificate has the same validity region as the"]
1549    #[doc = " * certificate that issued it."]
1550    #[doc = " *"]
1551    #[doc = " * The above algorithm is applied recursively, i.e. if region is omitted from"]
1552    #[doc = " * the issuing certificate, then the issuing certificate of that certificate is"]
1553    #[doc = " * inspected to determine if region is present, and so on. A certificate,"]
1554    #[doc = " * therefore, has global geographic validity as defined in 5.2.6.6.3.1 if"]
1555    #[doc = " * region is not present in the certificate or in any certificate in its chain."]
1556    #[doc = " * Otherwise, i.e., if region is present in the certificate or in at least one"]
1557    #[doc = " * certificate in its chain, the certificate has area validity as defined in"]
1558    #[doc = " * 5.2.6.6.3.1."]
1559    #[doc = " *"]
1560    #[doc = " * The use of the validity region to determine geographic consistency of an"]
1561    #[doc = " * SPDU is specified in 5.2.6.6.3.1. The use of the validity region to"]
1562    #[doc = " * determine geographic consistency of a subordinate certificate with an"]
1563    #[doc = " * issuing certificate is specified in 5.1.2.4."]
1564    #[doc = " *"]
1565    #[doc = " * @param assuranceLevel: indicates the assurance level of the certificate"]
1566    #[doc = " * holder."]
1567    #[doc = " *"]
1568    #[doc = " * @param appPermissions: indicates the permissions that the certificate"]
1569    #[doc = " * holder has to sign application data with this certificate. A valid"]
1570    #[doc = " * instance of appPermissions contains any particular Psid value in at most"]
1571    #[doc = " * one entry."]
1572    #[doc = " *"]
1573    #[doc = " * @param certIssuePermissions: indicates the permissions that the certificate"]
1574    #[doc = " * holder has to sign certificates with this certificate. A valid instance of"]
1575    #[doc = " * this array contains no more than one entry whose psidSspRange field"]
1576    #[doc = " * indicates all. If the array has multiple entries and one entry has its"]
1577    #[doc = " * psidSspRange field indicate all, then the entry indicating all specifies"]
1578    #[doc = " * the permissions for all PSIDs other than the ones explicitly specified in"]
1579    #[doc = " * the other entries. See the description of PsidGroupPermissions for further"]
1580    #[doc = " * discussion."]
1581    #[doc = " *"]
1582    #[doc = " * @param certRequestPermissions: indicates the permissions that the "]
1583    #[doc = " * certificate holder can request in its certificate. A valid instance of this"]
1584    #[doc = " * array contains no more than one entry whose psidSspRange field indicates "]
1585    #[doc = " * all. If the array has multiple entries and one entry has its psidSspRange "]
1586    #[doc = " * field indicate all, then the entry indicating all specifies the permissions "]
1587    #[doc = " * for all PSIDs other than the ones explicitly specified in the other entries."]
1588    #[doc = " * See the description of PsidGroupPermissions for further discussion."]
1589    #[doc = " *"]
1590    #[doc = " * @param canRequestRollover: indicates that the certificate may be used to"]
1591    #[doc = " * sign a request for another certificate with the same permissions. This"]
1592    #[doc = " * field is provided for future use and its use is not defined in this"]
1593    #[doc = " * version of this standard."]
1594    #[doc = " *"]
1595    #[doc = " * @param encryptionKey: contains a public key for encryption for which the"]
1596    #[doc = " * certificate holder holds the corresponding private key."]
1597    #[doc = " *"]
1598    #[doc = " * @param verifyKeyIndicator: contains material that may be used to recover"]
1599    #[doc = " * the public key that may be used to verify data signed by this certificate."]
1600    #[doc = " *"]
1601    #[doc = " * @param flags: indicates additional yes/no properties of the certificate "]
1602    #[doc = " * holder. The only bit with defined semantics in this string in this version "]
1603    #[doc = " * of this standard is usesCubk. If set, the usesCubk bit indicates that the "]
1604    #[doc = " * certificate holder supports the compact unified butterfly key response. "]
1605    #[doc = " * Further material about the compact unified butterfly key response can be "]
1606    #[doc = " * found in IEEE Std 1609.2.1."]
1607    #[doc = " *"]
1608    #[doc = " * If this field is present, at least one of the bits in the field shall be"]
1609    #[doc = " * non-zero."]
1610    #[doc = " *"]
1611    #[doc = " * @note usesCubk is only relevant for CA certificates, and the only "]
1612    #[doc = " * functionality defined associated with this field is associated with "]
1613    #[doc = " * consistency checks on received certificate responses. No functionality "]
1614    #[doc = " * associated with communications between peer SDEEs is defined associated "]
1615    #[doc = " * with this field."]
1616    #[doc = " *"]
1617    #[doc = " * @param appExtensions: indicates additional permissions that may be applied"]
1618    #[doc = " * to application activities that the certificate holder is carrying out. "]
1619    #[doc = " *"]
1620    #[doc = " * @param certIssueExtensions: indicates additional permissions to issue "]
1621    #[doc = " * certificates containing appExtensions. "]
1622    #[doc = " *"]
1623    #[doc = " * @param certRequestExtensions: indicates additional permissions to request "]
1624    #[doc = " * certificates containing endEntityExtensions."]
1625    #[doc = " *"]
1626    #[doc = " * @note In IEEE Std 1609.2-2022 these were not marked optional; they are in"]
1627    #[doc = " * this version of the standard; this is technically not backwards compatible"]
1628    #[doc = " * but in practice there are no scenarios in which a legacy system will break"]
1629    #[doc = " * (because it would have to be the case that Issue or Request was included and"]
1630    #[doc = " * App wasn't, but no issue or request extension values are currently defined)."]
1631    #[doc = " * "]
1632    #[doc = " * @note Issue and Request extensions are specified in this version of this"]
1633    #[doc = " * standard for future use but do not currently have any values defined. The"]
1634    #[doc = " * only certificate extension defined is OperatingOrganizationId and that can"]
1635    #[doc = " * be issued by any CA. It can be taken as likely that future appExtensions"]
1636    #[doc = " * will also be issuable by any CA, as otherwise consistency rules will differ"]
1637    #[doc = " * between appExtensions, and so in practice these certIssueExtensions and"]
1638    #[doc = " * certRequestExtensions fields will never be use. See Annex G for discussion"]
1639    #[doc = " * of how the standard could in principle be extended to include extensions"]
1640    #[doc = " * that do have a need to be validated up the chain."]
1641    #[doc = " *"]
1642    #[doc = " * @note Calculating the hash of a certificate:"]
1643    #[doc = " * For both implicit and explicit certificates, when the certificate"]
1644    #[doc = " * is hashed to create or recover the public key (in the case of an implicit"]
1645    #[doc = " * certificate) or to generate or verify the signature (in the case of an"]
1646    #[doc = " * explicit certificate), the hash is Hash (Data input) || Hash ("]
1647    #[doc = " * Signer identifier input), where:"]
1648    #[doc = " *   - Data input is the COER encoding of toBeSigned, canonicalized"]
1649    #[doc = " * as described above."]
1650    #[doc = " *   - Signer identifier input depends on the verification type,"]
1651    #[doc = " * which in turn depends on the choice indicated by issuer. If the choice"]
1652    #[doc = " * indicated by issuer is self, the verification type is self-signed and the"]
1653    #[doc = " * signer identifier input is the empty string. If the choice indicated by"]
1654    #[doc = " * issuer is not self, the verification type is certificate and the signer"]
1655    #[doc = " * identifier input is the COER encoding of the canonicalization per 6.4.3 of"]
1656    #[doc = " * the certificate indicated by issuer."]
1657    #[doc = " *"]
1658    #[doc = " *"]
1659    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
1660    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1661    #[doc = " * applies to the PublicEncryptionKey and to the VerificationKeyIndicator."]
1662    #[doc = " *"]
1663    #[doc = " * If the PublicEncryptionKey contains a BasePublicEncryptionKey that is an "]
1664    #[doc = " * elliptic curve point (i.e., of type EccP256CurvePoint or EccP384CurvePoint),"]
1665    #[doc = " * then the elliptic curve point is encoded in compressed form, i.e., such "]
1666    #[doc = " * that the choice indicated within the Ecc*CurvePoint is compressed-y-0 or "]
1667    #[doc = " * compressed-y-1."]
1668    #[doc = " *"]
1669    #[doc = " * @note Critical information fields:"]
1670    #[doc = " *   - If present, appPermissions is a critical information field as defined "]
1671    #[doc = " * in 5.2.6. If an implementation of verification does not support the number "]
1672    #[doc = " * of PsidSsp in the appPermissions field of a certificate that signed a "]
1673    #[doc = " * signed SPDU, that implementation shall indicate that the signed SPDU is "]
1674    #[doc = " * invalid in the sense of 4.2.2.3.2, that is, it is invalid in the sense "]
1675    #[doc = " * that its validity cannot be established.. A conformant implementation "]
1676    #[doc = " * shall support appPermissions fields containing at least eight entries. "]
1677    #[doc = " * It may be the case that an implementation of verification does not support "]
1678    #[doc = " * the number of entries in  the appPermissions field and the appPermissions "]
1679    #[doc = " * field is not relevant to the verification: this will occur, for example, "]
1680    #[doc = " * if the certificate in question is a CA certificate and so the "]
1681    #[doc = " * certIssuePermissions field is relevant to the verification and the "]
1682    #[doc = " * appPermissions field is not. In this case, whether the implementation "]
1683    #[doc = " * indicates that the signed SPDU is valid (because it could validate all "]
1684    #[doc = " * relevant fields) or invalid (because it could not parse the entire "]
1685    #[doc = " * certificate) is implementation-specific."]
1686    #[doc = " *   - If present, certIssuePermissions is a critical information field as "]
1687    #[doc = " * defined in 5.2.6. If an implementation of verification does not support "]
1688    #[doc = " * the number of PsidGroupPermissions in the certIssuePermissions field of a "]
1689    #[doc = " * CA certificate in the chain of a signed SPDU, the implementation shall "]
1690    #[doc = " * indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, that "]
1691    #[doc = " * is, it is invalid in the sense that its validity cannot be established. "]
1692    #[doc = " * A conformant implementation shall support certIssuePermissions fields "]
1693    #[doc = " * containing at least eight entries."]
1694    #[doc = " * It may be the case that an implementation of verification does not support"]
1695    #[doc = " * the number of entries in  the certIssuePermissions field and the "]
1696    #[doc = " * certIssuePermissions field is not relevant to the verification: this will "]
1697    #[doc = " * occur, for example, if the certificate in question is the signing "]
1698    #[doc = " * certificate for the SPDU and so the appPermissions field is relevant to "]
1699    #[doc = " * the verification and the certIssuePermissions field is not. In this case, "]
1700    #[doc = " * whether the implementation indicates that the signed SPDU is valid "]
1701    #[doc = " * (because it could validate all relevant fields) or invalid (because it "]
1702    #[doc = " * could not parse the entire certificate) is implementation-specific."]
1703    #[doc = " *   - If present, certRequestPermissions is a critical information field as "]
1704    #[doc = " * defined in 5.2.6. If an implementaiton of verification of a certificate "]
1705    #[doc = " * request does not support the number of PsidGroupPermissions in "]
1706    #[doc = " * certRequestPermissions, the implementation shall indicate that the signed "]
1707    #[doc = " * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the "]
1708    #[doc = " * sense that its validity cannot be established. A conformant implementation "]
1709    #[doc = " * shall support certRequestPermissions fields containing at least eight "]
1710    #[doc = " * entries."]
1711    #[doc = " * It may be the case that an implementation of verification does not support "]
1712    #[doc = " * the number of entries in  the certRequestPermissions field and the "]
1713    #[doc = " * certRequestPermissions field is not relevant to the verification: this will "]
1714    #[doc = " * occur, for example, if the certificate in question is the signing "]
1715    #[doc = " * certificate for the SPDU and so the appPermissions field is relevant to "]
1716    #[doc = " * the verification and the certRequestPermissions field is not. In this "]
1717    #[doc = " * case, whether the implementation indicates that the signed SPDU is valid "]
1718    #[doc = " * (because it could validate all relevant fields) or invalid (because it "]
1719    #[doc = " * could not parse the entire certificate) is implementation-specific."]
1720    #[doc = " "]
1721    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1722    #[rasn(automatic_tags)]
1723    #[non_exhaustive]
1724    pub struct ToBeSignedCertificate {
1725        pub id: CertificateId,
1726        #[rasn(identifier = "cracaId")]
1727        pub craca_id: HashedId3,
1728        #[rasn(identifier = "crlSeries")]
1729        pub crl_series: CrlSeries,
1730        #[rasn(identifier = "validityPeriod")]
1731        pub validity_period: ValidityPeriod,
1732        pub region: Option<GeographicRegion>,
1733        #[rasn(identifier = "assuranceLevel")]
1734        pub assurance_level: Option<SubjectAssurance>,
1735        #[rasn(identifier = "appPermissions")]
1736        pub app_permissions: Option<SequenceOfPsidSsp>,
1737        #[rasn(identifier = "certIssuePermissions")]
1738        pub cert_issue_permissions: Option<SequenceOfPsidGroupPermissions>,
1739        #[rasn(identifier = "certRequestPermissions")]
1740        pub cert_request_permissions: Option<SequenceOfPsidGroupPermissions>,
1741        #[rasn(identifier = "canRequestRollover")]
1742        pub can_request_rollover: Option<()>,
1743        #[rasn(identifier = "encryptionKey")]
1744        pub encryption_key: Option<PublicEncryptionKey>,
1745        #[rasn(identifier = "verifyKeyIndicator")]
1746        pub verify_key_indicator: VerificationKeyIndicator,
1747        #[rasn(extension_addition, size("8"))]
1748        pub flags: Option<BitString>,
1749        // Constraints repeated on the extension-addition fields (rasn drops
1750        // those of a delegate type there; no change in COER for SIZE (1..)).
1751        #[rasn(extension_addition, size("1.."), identifier = "appExtensions")]
1752        pub app_extensions: Option<SequenceOfAppExtensions>,
1753        #[rasn(extension_addition, size("1.."), identifier = "certIssueExtensions")]
1754        pub cert_issue_extensions: Option<SequenceOfCertIssueExtensions>,
1755        #[rasn(extension_addition, size("1.."), identifier = "certRequestExtension")]
1756        pub cert_request_extension: Option<SequenceOfCertRequestExtensions>,
1757    }
1758    impl ToBeSignedCertificate {
1759        pub fn new(
1760            id: CertificateId,
1761            craca_id: HashedId3,
1762            crl_series: CrlSeries,
1763            validity_period: ValidityPeriod,
1764            region: Option<GeographicRegion>,
1765            assurance_level: Option<SubjectAssurance>,
1766            app_permissions: Option<SequenceOfPsidSsp>,
1767            cert_issue_permissions: Option<SequenceOfPsidGroupPermissions>,
1768            cert_request_permissions: Option<SequenceOfPsidGroupPermissions>,
1769            can_request_rollover: Option<()>,
1770            encryption_key: Option<PublicEncryptionKey>,
1771            verify_key_indicator: VerificationKeyIndicator,
1772            flags: Option<BitString>,
1773            app_extensions: Option<SequenceOfAppExtensions>,
1774            cert_issue_extensions: Option<SequenceOfCertIssueExtensions>,
1775            cert_request_extension: Option<SequenceOfCertRequestExtensions>,
1776        ) -> Self {
1777            Self {
1778                id,
1779                craca_id,
1780                crl_series,
1781                validity_period,
1782                region,
1783                assurance_level,
1784                app_permissions,
1785                cert_issue_permissions,
1786                cert_request_permissions,
1787                can_request_rollover,
1788                encryption_key,
1789                verify_key_indicator,
1790                flags,
1791                app_extensions,
1792                cert_issue_extensions,
1793                cert_request_extension,
1794            }
1795        }
1796    }
1797    #[doc = "*"]
1798    #[doc = " * @brief This structure contains the data to be hashed when generating or"]
1799    #[doc = " * verifying a signature. See 6.3.4 for the specification of the input to the"]
1800    #[doc = " * hash."]
1801    #[doc = " *"]
1802    #[doc = " * @param payload: contains data that is provided by the entity that invokes"]
1803    #[doc = " * the SDS."]
1804    #[doc = " *"]
1805    #[doc = " * @param headerInfo: contains additional data that is inserted by the SDS."]
1806    #[doc = " * This structure is used as follows to determine the \"data input\" to the "]
1807    #[doc = " * hash operation for signing or verification as specified in 5.3.1.2.2 or "]
1808    #[doc = " * 5.3.1.3."]
1809    #[doc = " *   - If payload does not contain the field omitted, the data input to the "]
1810    #[doc = " * hash operation is the COER encoding of the ToBeSignedData. "]
1811    #[doc = " *   - If payload field in this ToBeSignedData instance contains the field "]
1812    #[doc = " * omitted, the data input to the hash operation is the COER encoding of the"]
1813    #[doc = " * ToBeSignedData, concatenated with the hash of the omitted payload. The hash"]
1814    #[doc = " * of the omitted payload is calculated with the same hash algorithm that is "]
1815    #[doc = " * used to calculate the hash of the data input for signing or verification. "]
1816    #[doc = " * The data input to the hash operation is simply the COER encoding of the "]
1817    #[doc = " * ToBeSignedData, concatenated with the hash of the omitted payload: there is"]
1818    #[doc = " * no additional wrapping or length indication. As noted in 5.2.4.3.4, the "]
1819    #[doc = " * means by which the signer and verifier establish the contents of the "]
1820    #[doc = " * omitted payload are outside the scope of this standard."]
1821    #[doc = " *"]
1822    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
1823    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1824    #[doc = " * applies to the SignedDataPayload if it is of type data, and to the "]
1825    #[doc = " * HeaderInfo."]
1826    #[doc = " "]
1827    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1828    #[rasn(automatic_tags)]
1829    pub struct ToBeSignedData {
1830        pub payload: Box<SignedDataPayload>,
1831        #[rasn(identifier = "headerInfo")]
1832        pub header_info: HeaderInfo,
1833    }
1834    impl ToBeSignedData {
1835        pub fn new(payload: Box<SignedDataPayload>, header_info: HeaderInfo) -> Self {
1836            Self {
1837                payload,
1838                header_info,
1839            }
1840        }
1841    }
1842    #[doc = "*"]
1843    #[doc = " * @brief The contents of this field depend on whether the certificate is an"]
1844    #[doc = " * implicit or an explicit certificate."]
1845    #[doc = " *"]
1846    #[doc = " * @param verificationKey: is included in explicit certificates. It contains"]
1847    #[doc = " * the public key to be used to verify signatures generated by the holder of"]
1848    #[doc = " * the Certificate."]
1849    #[doc = " *"]
1850    #[doc = " * @param reconstructionValue: is included in implicit certificates. It"]
1851    #[doc = " * contains the reconstruction value, which is used to recover the public key"]
1852    #[doc = " * as specified in SEC 4 and 5.3.2."]
1853    #[doc = " *"]
1854    #[doc = " * @note Critical information fields: If present, this is a critical "]
1855    #[doc = " * information field as defined in 5.2.5. An implementation that does not "]
1856    #[doc = " * recognize the indicated CHOICE for this type when verifying a signed SPDU "]
1857    #[doc = " * shall indicate that the signed SPDU is invalid indicate that the signed "]
1858    #[doc = " * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the "]
1859    #[doc = " * sense that its validity cannot be established."]
1860    #[doc = " *"]
1861    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
1862    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
1863    #[doc = " * applies to the PublicVerificationKey and to the EccP256CurvePoint. The "]
1864    #[doc = " * EccP256CurvePoint is encoded in compressed form, i.e., such that the "]
1865    #[doc = " * choice indicated within the EccP256CurvePoint is compressed-y-0 or "]
1866    #[doc = " * compressed-y-1."]
1867    #[doc = " "]
1868    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1869    #[rasn(choice, automatic_tags)]
1870    #[non_exhaustive]
1871    pub enum VerificationKeyIndicator {
1872        verificationKey(PublicVerificationKey),
1873        reconstructionValue(EccP256CurvePoint),
1874    }
1875    pub const CERT_EXT_ID_OPERATING_ORGANIZATION: ExtId = ExtId(1);
1876    pub const ETSI_HEADER_INFO_CONTRIBUTOR_ID: HeaderInfoContributorId = HeaderInfoContributorId(2);
1877    pub const IEEE1609_HEADER_INFO_CONTRIBUTOR_ID: HeaderInfoContributorId =
1878        HeaderInfoContributorId(1);
1879    pub const ISO21177_EXTENDED_AUTH: PduFunctionalType = PduFunctionalType(2);
1880    pub const ISO21177_SESSION_EXTENSION: PduFunctionalType = PduFunctionalType(3);
1881    pub const P2PCD8_BYTE_LEARNING_REQUEST_ID: Ieee1609HeaderInfoExtensionId =
1882        Ieee1609HeaderInfoExtensionId(ExtId(1));
1883    pub const TLS_HANDSHAKE: PduFunctionalType = PduFunctionalType(1);
1884}
1885#[allow(
1886    non_camel_case_types,
1887    non_snake_case,
1888    non_upper_case_globals,
1889    unused,
1890    clippy::too_many_arguments
1891)]
1892pub mod ieee1609_dot2_base_types {
1893    extern crate alloc;
1894    use core::borrow::Borrow;
1895    use rasn::prelude::*;
1896    use std::sync::LazyLock;
1897    #[doc = "*"]
1898    #[doc = " * @brief This structure specifies the bytes of a public encryption key for "]
1899    #[doc = " * a particular algorithm. Supported public key encryption algorithms are "]
1900    #[doc = " * defined in 5.3.5."]
1901    #[doc = " *"]
1902    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
1903    #[doc = " * for the relevant operations specified in 6.1.2 if it appears in a "]
1904    #[doc = " * HeaderInfo or in a ToBeSignedCertificate. See the definitions of HeaderInfo"]
1905    #[doc = " * and ToBeSignedCertificate for a specification of the canonicalization"]
1906    #[doc = " * operations."]
1907    #[doc = " "]
1908    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1909    #[rasn(choice, automatic_tags)]
1910    #[non_exhaustive]
1911    pub enum BasePublicEncryptionKey {
1912        eciesNistP256(EccP256CurvePoint),
1913        eciesBrainpoolP256r1(EccP256CurvePoint),
1914        #[rasn(extension_addition)]
1915        ecencSm2(EccP256CurvePoint),
1916    }
1917    #[doc = "*"]
1918    #[doc = " * @brief This structure represents a bitmap representation of a SSP. The"]
1919    #[doc = " * mapping of the bits of the bitmap to constraints on the signed SPDU is"]
1920    #[doc = " * PSID-specific."]
1921    #[doc = " *"]
1922    #[doc = " * @note Consistency with issuing certificate: If a certificate has an"]
1923    #[doc = " * appPermissions entry A for which the ssp field is bitmapSsp, A is"]
1924    #[doc = " * consistent with the issuing certificate if the  certificate contains one"]
1925    #[doc = " * of the following:"]
1926    #[doc = " *   - (OPTION 1) A SubjectPermissions field indicating the choice all and"]
1927    #[doc = " * no PsidSspRange field containing the psid field in A;"]
1928    #[doc = " *   - (OPTION 2) A PsidSspRange P for which the following holds:"]
1929    #[doc = " *     - The psid field in P is equal to the psid field in A and one of the"]
1930    #[doc = " * following is true:"]
1931    #[doc = " *       - EITHER The sspRange field in P indicates all"]
1932    #[doc = " *       - OR The sspRange field in P indicates bitmapSspRange and for every"]
1933    #[doc = " * bit set to 1 in the sspBitmask in P, the bit in the identical position in"]
1934    #[doc = " * the sspValue in A is set equal to the bit in that position in the"]
1935    #[doc = " * sspValue in P."]
1936    #[doc = " *"]
1937    #[doc = " * @note To restate the final sub-bullet point immediately above: A BitmapSsp B"]
1938    #[doc = " * is consistent with a BitmapSspRange R if for every bit set to 1 in the"]
1939    #[doc = " * sspBitmask in R, the bit in the identical position in B is set equal to the"]
1940    #[doc = " * bit in that position in the sspValue in R. For each bit set to 0 in the"]
1941    #[doc = " * sspBitmask in R, the corresponding bit in the identical position in B may be"]
1942    #[doc = " * freely set to 0 or 1, i.e., if a bit is set to 0 in the sspBitmask in R, the"]
1943    #[doc = " * value of corresponding bit in the identical position in B has no bearing on"]
1944    #[doc = " * whether B and R are consistent."]
1945    #[doc = " *"]
1946    #[doc = " * @note Where a BitmapSsp in an authorization certificate is being compared"]
1947    #[doc = " * with a BitmapSspRange in an issuing certificate, the rules given above imply"]
1948    #[doc = " * that the BitmapSsp: (a) cannot be longer than BitmapSspRange in the issuing"]
1949    #[doc = " * cert; (b) Can be shorter than the BitmapSspRange but must be long enough to"]
1950    #[doc = " * reach the last \"1\" bit in the sspBitmask."]
1951    #[doc = " "]
1952    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1953    #[rasn(delegate, size("0..=31"))]
1954    pub struct BitmapSsp(pub OctetString);
1955    #[doc = "*"]
1956    #[doc = " * @brief This structure represents a bitmap representation of a SSP. The"]
1957    #[doc = " * sspValue indicates permissions. The sspBitmask contains an octet string"]
1958    #[doc = " * used to permit or constrain sspValue fields in issued certificates. The"]
1959    #[doc = " * sspValue and sspBitmask fields shall be of the same length."]
1960    #[doc = " *"]
1961    #[doc = " * @note Consistency with issuing certificate: If a certificate has an"]
1962    #[doc = " * PsidSspRange value P for which the sspRange field is bitmapSspRange,"]
1963    #[doc = " * P is consistent with the issuing certificate if the issuing certificate"]
1964    #[doc = " * contains one of the following:"]
1965    #[doc = " *   - (OPTION 1) A SubjectPermissions field indicating the choice all and"]
1966    #[doc = " * no PsidSspRange field containing the psid field in P;"]
1967    #[doc = " *   - (OPTION 2) A PsidSspRange R for which the following holds:"]
1968    #[doc = " *     - The psid field in R is equal to the psid field in P and one of the"]
1969    #[doc = " * following is true:"]
1970    #[doc = " *       - EITHER The sspRange field in R indicates all"]
1971    #[doc = " *       - OR The sspRange field in R indicates bitmapSspRange and for every"]
1972    #[doc = " * bit set to 1 in the sspBitmask in R:"]
1973    #[doc = " *         - The bit in the identical position in the sspBitmask in P is set"]
1974    #[doc = " * equal to 1, AND"]
1975    #[doc = " *         - The bit in the identical position in the sspValue in P is set equal"]
1976    #[doc = " * to the bit in that position in the sspValue in R."]
1977    #[doc = " *"]
1978    #[doc = " * Reference ETSI TS 103 097 for more information on bitmask SSPs."]
1979    #[doc = " "]
1980    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
1981    #[rasn(automatic_tags)]
1982    pub struct BitmapSspRange {
1983        #[rasn(size("1..=32"), identifier = "sspValue")]
1984        pub ssp_value: OctetString,
1985        #[rasn(size("1..=32"), identifier = "sspBitmask")]
1986        pub ssp_bitmask: OctetString,
1987    }
1988    impl BitmapSspRange {
1989        pub fn new(ssp_value: OctetString, ssp_bitmask: OctetString) -> Self {
1990            Self {
1991                ssp_value,
1992                ssp_bitmask,
1993            }
1994        }
1995    }
1996    #[doc = "*"]
1997    #[doc = " * @brief This structure specifies a circle with its center at center, its"]
1998    #[doc = " * radius given in meters, and located tangential to the reference ellipsoid."]
1999    #[doc = " * The indicated region is all the points on the surface of the reference"]
2000    #[doc = " * ellipsoid whose distance to the center point over the reference ellipsoid"]
2001    #[doc = " * is less than or equal to the radius. A point which contains an elevation"]
2002    #[doc = " * component is considered to be within the circular region if its horizontal"]
2003    #[doc = " * projection onto the reference ellipsoid lies within the region."]
2004    #[doc = " "]
2005    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2006    #[rasn(automatic_tags)]
2007    pub struct CircularRegion {
2008        pub center: TwoDLocation,
2009        pub radius: Uint16,
2010    }
2011    impl CircularRegion {
2012        pub fn new(center: TwoDLocation, radius: Uint16) -> Self {
2013            Self { center, radius }
2014        }
2015    }
2016    #[doc = "*"]
2017    #[doc = " * @brief A conformant implementation that supports CountryAndRegions shall "]
2018    #[doc = " * support a regions field containing at least eight entries."]
2019    #[doc = " * A conformant implementation that implements this type shall recognize "]
2020    #[doc = " * (in the sense of \"be able to determine whether a two dimensional location "]
2021    #[doc = " * lies inside or outside the borders identified by\") at least one value of "]
2022    #[doc = " * UnCountryId and at least one value for a region within the country "]
2023    #[doc = " * indicated by that recognized UnCountryId value. In this version of this "]
2024    #[doc = " * standard, the only means to satisfy this is for a conformant "]
2025    #[doc = " * implementation to recognize the value of UnCountryId indicating USA and "]
2026    #[doc = " * at least one of the FIPS state codes for US states. The Protocol "]
2027    #[doc = " * Implementation Conformance Statement (PICS) provided in Annex A allows "]
2028    #[doc = " * an implementation to state which UnCountryId values it recognizes and "]
2029    #[doc = " * which region values are recognized within that country."]
2030    #[doc = " * If a verifying implementation is required to check that relevant "]
2031    #[doc = " * geographic information in a signed SPDU is consistent with a certificate "]
2032    #[doc = " * containing one or more instances of this type, then the SDS is permitted "]
2033    #[doc = " * to indicate that the signed SPDU is valid even if some values of country "]
2034    #[doc = " * or within regions are unrecognized in the sense defined above, so long "]
2035    #[doc = " * as the recognized instances of this type completely contain the relevant "]
2036    #[doc = " * geographic information. Informally, if the recognized values in the "]
2037    #[doc = " * certificate allow the SDS to determine that the SPDU is valid, then it "]
2038    #[doc = " * can make that determination even if there are also unrecognized values "]
2039    #[doc = " * in the certificate. This field is therefore not a \"critical information "]
2040    #[doc = " * field\" as defined in 5.2.6, because unrecognized values are permitted so "]
2041    #[doc = " * long as the validity of the SPDU can be established with the recognized "]
2042    #[doc = " * values. However, as discussed in 5.2.6, the presence of an unrecognized "]
2043    #[doc = " * value in a certificate can make it impossible to determine whether the "]
2044    #[doc = " * certificate is valid and so whether the SPDU is valid."]
2045    #[doc = " * In this type:"]
2046    #[doc = " *"]
2047    #[doc = " * @param countryOnly: is a UnCountryId as defined above."]
2048    #[doc = " *"]
2049    #[doc = " * @param regions: identifies one or more regions within the country. If "]
2050    #[doc = " * country indicates the United States of America, the values in this field "]
2051    #[doc = " * identify the state or statistically equivalent entity using the integer "]
2052    #[doc = " * version of the 2010 FIPS codes as provided by the U.S. Census Bureau "]
2053    #[doc = " * (see normative references in Clause 0). For other values of country, the "]
2054    #[doc = " * meaning of region is not defined in this version of this standard."]
2055    #[doc = " "]
2056    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2057    #[rasn(automatic_tags)]
2058    pub struct CountryAndRegions {
2059        #[rasn(identifier = "countryOnly")]
2060        pub country_only: UnCountryId,
2061        pub regions: SequenceOfUint8,
2062    }
2063    impl CountryAndRegions {
2064        pub fn new(country_only: UnCountryId, regions: SequenceOfUint8) -> Self {
2065            Self {
2066                country_only,
2067                regions,
2068            }
2069        }
2070    }
2071    #[doc = "*"]
2072    #[doc = " * @brief A conformant implementation that supports CountryAndSubregions "]
2073    #[doc = " * shall support a regionAndSubregions field containing at least eight "]
2074    #[doc = " * entries."]
2075    #[doc = " * A conformant implementation that implements this type shall recognize "]
2076    #[doc = " * (in the sense of �be able to determine whether a two dimensional location "]
2077    #[doc = " * lies inside or outside the borders identified by�) at least one value of "]
2078    #[doc = " * country and at least one value for a region within the country indicated "]
2079    #[doc = " * by that recognized country value. In this version of this standard, the "]
2080    #[doc = " * only means to satisfy this is for a conformant implementation to recognize "]
2081    #[doc = " * the value of UnCountryId indicating USA and at least one of the FIPS state "]
2082    #[doc = " * codes for US states. The Protocol Implementation Conformance Statement "]
2083    #[doc = " * (PICS) provided in Annex A allows an implementation to state which "]
2084    #[doc = " * UnCountryId values it recognizes and which region values are recognized "]
2085    #[doc = " * within that country."]
2086    #[doc = " * If a verifying implementation is required to check that relevant "]
2087    #[doc = " * geographic information in a signed SPDU is consistent with a certificate "]
2088    #[doc = " * containing one or more instances of this type, then the SDS is permitted "]
2089    #[doc = " * to indicate that the signed SPDU is valid even if some values of country "]
2090    #[doc = " * or within regionAndSubregions are unrecognized in the sense defined above,"]
2091    #[doc = " * so long as the recognized instances of this type completely contain the "]
2092    #[doc = " * relevant geographic information. Informally, if the recognized values in "]
2093    #[doc = " * the certificate allow the SDS to determine that the SPDU is valid, then "]
2094    #[doc = " * it can make that determination even if there are also unrecognized values "]
2095    #[doc = " * in the certificate. This field is therefore not a \"critical information "]
2096    #[doc = " * field\" as defined in 5.2.6, because unrecognized values are permitted so "]
2097    #[doc = " * long as the validity of the SPDU can be established with the recognized "]
2098    #[doc = " * values. However, as discussed in 5.2.6, the presence of an unrecognized "]
2099    #[doc = " * value in a certificate can make it impossible to determine whether the "]
2100    #[doc = " * certificate is valid and so whether the SPDU is valid."]
2101    #[doc = " * In this structure:"]
2102    #[doc = " *"]
2103    #[doc = " * @param countryOnly: is a UnCountryId as defined above."]
2104    #[doc = " *"]
2105    #[doc = " * @param regionAndSubregions: identifies one or more subregions within "]
2106    #[doc = " * country."]
2107    #[doc = " "]
2108    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2109    #[rasn(automatic_tags)]
2110    pub struct CountryAndSubregions {
2111        #[rasn(identifier = "countryOnly")]
2112        pub country_only: UnCountryId,
2113        #[rasn(identifier = "regionAndSubregions")]
2114        pub region_and_subregions: SequenceOfRegionAndSubregions,
2115    }
2116    impl CountryAndSubregions {
2117        pub fn new(
2118            country_only: UnCountryId,
2119            region_and_subregions: SequenceOfRegionAndSubregions,
2120        ) -> Self {
2121            Self {
2122                country_only,
2123                region_and_subregions,
2124            }
2125        }
2126    }
2127    #[doc = "*"]
2128    #[doc = " * @brief This type is defined only for backwards compatibility."]
2129    #[doc = " "]
2130    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2131    #[rasn(delegate)]
2132    pub struct CountryOnly(pub UnCountryId);
2133    #[doc = "*"]
2134    #[doc = " * @brief This integer identifies a series of CRLs issued under the authority"]
2135    #[doc = " * of a particular CRACA."]
2136    #[doc = " "]
2137    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2138    #[rasn(delegate)]
2139    pub struct CrlSeries(pub Uint16);
2140    #[doc = "*"]
2141    #[doc = " * @brief This structure represents the duration of validity of a"]
2142    #[doc = " * certificate. The Uint16 value is the duration, given in the units denoted"]
2143    #[doc = " * by the indicated choice. A year is considered to be 31556952 seconds,"]
2144    #[doc = " * which is the average number of seconds in a year."]
2145    #[doc = " * "]
2146    #[doc = " * @note Years can be mapped more closely to wall-clock days using the hours "]
2147    #[doc = " * choice for up to 7 years and the sixtyHours choice for up to 448 years. "]
2148    #[doc = " "]
2149    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2150    #[rasn(choice, automatic_tags)]
2151    pub enum Duration {
2152        microseconds(Uint16),
2153        milliseconds(Uint16),
2154        seconds(Uint16),
2155        minutes(Uint16),
2156        hours(Uint16),
2157        sixtyHours(Uint16),
2158        years(Uint16),
2159    }
2160    #[doc = " Inner type "]
2161    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2162    #[rasn(automatic_tags)]
2163    pub struct EccP256CurvePointUncompressedP256 {
2164        #[rasn(size("32"))]
2165        pub x: OctetString,
2166        #[rasn(size("32"))]
2167        pub y: OctetString,
2168    }
2169    impl EccP256CurvePointUncompressedP256 {
2170        pub fn new(x: OctetString, y: OctetString) -> Self {
2171            Self { x, y }
2172        }
2173    }
2174    #[doc = "*"]
2175    #[doc = " * @brief This structure specifies a point on an elliptic curve in Weierstrass"]
2176    #[doc = " * form defined over a 256-bit prime number. The curves supported in this"]
2177    #[doc = " * standard are NIST p256 as defined in FIPS 186-5, Brainpool p256r1 as"]
2178    #[doc = " * defined in RFC 5639, and the SM2 curve as defined in GB/T 32918.5-2017."]
2179    #[doc = " * The fields in this structure are OCTET STRINGS produced with the elliptic"]
2180    #[doc = " * curve point encoding and decoding methods defined in subclause 5.5.6 of"]
2181    #[doc = " * IEEE Std 1363-2000. The x-coordinate is encoded as an unsigned integer of"]
2182    #[doc = " * length 32 octets in network byte order for all values of the CHOICE; the"]
2183    #[doc = " * encoding of the y-coordinate y depends on whether the point is x-only,"]
2184    #[doc = " * compressed, or uncompressed. If the point is x-only, y is omitted. If the"]
2185    #[doc = " * point is compressed, the value of type depends on the least significant"]
2186    #[doc = " * bit of y: if the least significant bit of y is 0, type takes the value"]
2187    #[doc = " * compressed-y-0, and if the least significant bit of y is 1, type takes the"]
2188    #[doc = " * value compressed-y-1. If the point is uncompressed, y is encoded explicitly"]
2189    #[doc = " * as an unsigned integer of length 32 octets in network byte order."]
2190    #[doc = " *"]
2191    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
2192    #[doc = " * for the relevant operations specified in 6.1.2 if it appears in a "]
2193    #[doc = " * HeaderInfo or in a ToBeSignedCertificate. See the definitions of HeaderInfo"]
2194    #[doc = " * and ToBeSignedCertificate for a specification of the canonicalization "]
2195    #[doc = " * operations."]
2196    #[doc = " "]
2197    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2198    #[rasn(choice, automatic_tags)]
2199    pub enum EccP256CurvePoint {
2200        #[rasn(size("32"), identifier = "x-only")]
2201        x_only(OctetString),
2202        fill(()),
2203        #[rasn(size("32"), identifier = "compressed-y-0")]
2204        compressed_y_0(OctetString),
2205        #[rasn(size("32"), identifier = "compressed-y-1")]
2206        compressed_y_1(OctetString),
2207        uncompressedP256(EccP256CurvePointUncompressedP256),
2208    }
2209    #[doc = " Inner type "]
2210    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2211    #[rasn(automatic_tags)]
2212    pub struct EccP384CurvePointUncompressedP384 {
2213        #[rasn(size("48"))]
2214        pub x: OctetString,
2215        #[rasn(size("48"))]
2216        pub y: OctetString,
2217    }
2218    impl EccP384CurvePointUncompressedP384 {
2219        pub fn new(x: OctetString, y: OctetString) -> Self {
2220            Self { x, y }
2221        }
2222    }
2223    #[doc = "*"]
2224    #[doc = " * @brief This structure specifies a point on an elliptic curve in"]
2225    #[doc = " * Weierstrass form defined over a 384-bit prime number. The only supported"]
2226    #[doc = " * such curve in this standard is Brainpool p384r1 as defined in RFC 5639."]
2227    #[doc = " * The fields in this structure are octet strings produced with the elliptic"]
2228    #[doc = " * curve point encoding and decoding methods defined in subclause 5.5.6 of"]
2229    #[doc = " * IEEE Std 1363-2000. The x-coordinate is encoded as an unsigned integer of"]
2230    #[doc = " * length 48 octets in network byte order for all values of the CHOICE; the"]
2231    #[doc = " * encoding of the y-coordinate y depends on whether the point is x-only,"]
2232    #[doc = " * compressed, or uncompressed. If the point is x-only, y is omitted. If the"]
2233    #[doc = " * point is compressed, the value of type depends on the least significant"]
2234    #[doc = " * bit of y: if the least significant bit of y is 0, type takes the value"]
2235    #[doc = " * compressed-y-0, and if the least significant bit of y is 1, type takes the"]
2236    #[doc = " * value compressed-y-1. If the point is uncompressed, y is encoded"]
2237    #[doc = " * explicitly as an unsigned integer of length 48 octets in network byte order."]
2238    #[doc = " * "]
2239    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
2240    #[doc = " * for the relevant operations specified in 6.1.2 if it appears in a "]
2241    #[doc = " * HeaderInfo or in a ToBeSignedCertificate. See the definitions of HeaderInfo"]
2242    #[doc = " * and ToBeSignedCertificate for a specification of the canonicalization "]
2243    #[doc = " * operations."]
2244    #[doc = " "]
2245    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2246    #[rasn(choice, automatic_tags)]
2247    pub enum EccP384CurvePoint {
2248        #[rasn(size("48"), identifier = "x-only")]
2249        x_only(OctetString),
2250        fill(()),
2251        #[rasn(size("48"), identifier = "compressed-y-0")]
2252        compressed_y_0(OctetString),
2253        #[rasn(size("48"), identifier = "compressed-y-1")]
2254        compressed_y_1(OctetString),
2255        uncompressedP384(EccP384CurvePointUncompressedP384),
2256    }
2257    #[doc = "*"]
2258    #[doc = " * @brief This structure represents an ECDSA signature. The signature is"]
2259    #[doc = " * generated as specified in 5.3.1."]
2260    #[doc = " *"]
2261    #[doc = " * If the signature process followed the specification of FIPS 186-5"]
2262    #[doc = " * and output the integer r, r is represented as an EccP256CurvePoint"]
2263    #[doc = " * indicating the selection x-only."]
2264    #[doc = " *"]
2265    #[doc = " * If the signature process followed the specification of SEC 1 and"]
2266    #[doc = " * output the elliptic curve point R to allow for fast verification, R is"]
2267    #[doc = " * represented as an EccP256CurvePoint indicating the choice compressed-y-0,"]
2268    #[doc = " * compressed-y-1, or uncompressed at the sender's discretion."]
2269    #[doc = " *"]
2270    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
2271    #[doc = " * for the relevant operations specified in 6.1.2. When this data structure "]
2272    #[doc = " * is canonicalized, the EccP256CurvePoint in rSig is represented in the "]
2273    #[doc = " * form x-only."]
2274    #[doc = " *"]
2275    #[doc = " * @note When the signature is of form x-only, the x-value in rSig is"]
2276    #[doc = " * an integer mod n, the order of the group; when the signature is of form"]
2277    #[doc = " * compressed-y-\\*, the x-value in rSig is an integer mod p, the underlying"]
2278    #[doc = " * prime defining the finite field. In principle, this means that to convert a"]
2279    #[doc = " * signature from form compressed-y-\\* to form x-only, the converter checks "]
2280    #[doc = " * the x-value to see if it lies between n and p and reduces it mod n if so. "]
2281    #[doc = " * In practice, this check is unnecessary: Haase's Theorem states that "]
2282    #[doc = " * difference between n and p is always less than 2*square-root(p), and so the "]
2283    #[doc = " * chance that an integer lies between n and p, for a 256-bit curve, is "]
2284    #[doc = " * bounded above by approximately square-root(p)/p or 2^(-128). For the "]
2285    #[doc = " * 256-bit curves in this standard, the exact values of n and p in hexadecimal "]
2286    #[doc = " * are:"]
2287    #[doc = " *"]
2288    #[doc = " * NISTp256:"]
2289    #[doc = " *   - p = FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"]
2290    #[doc = " *   - n = FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"]
2291    #[doc = " *"]
2292    #[doc = " * Brainpoolp256:"]
2293    #[doc = " *   - p = A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377"]
2294    #[doc = " *   - n = A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7"]
2295    #[doc = " "]
2296    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2297    #[rasn(automatic_tags)]
2298    pub struct EcdsaP256Signature {
2299        #[rasn(identifier = "rSig")]
2300        pub r_sig: EccP256CurvePoint,
2301        #[rasn(size("32"), identifier = "sSig")]
2302        pub s_sig: OctetString,
2303    }
2304    impl EcdsaP256Signature {
2305        pub fn new(r_sig: EccP256CurvePoint, s_sig: OctetString) -> Self {
2306            Self { r_sig, s_sig }
2307        }
2308    }
2309    #[doc = "*"]
2310    #[doc = " * @brief This structure represents an ECDSA signature. The signature is"]
2311    #[doc = " * generated as specified in 5.3.1."]
2312    #[doc = " *"]
2313    #[doc = " * If the signature process followed the specification of FIPS 186-5"]
2314    #[doc = " * and output the integer r, r is represented as an EccP384CurvePoint"]
2315    #[doc = " * indicating the selection x-only."]
2316    #[doc = " *"]
2317    #[doc = " * If the signature process followed the specification of SEC 1 and"]
2318    #[doc = " * output the elliptic curve point R to allow for fast verification, R is"]
2319    #[doc = " * represented as an EccP384CurvePoint indicating the choice compressed-y-0,"]
2320    #[doc = " * compressed-y-1, or uncompressed at the sender's discretion."]
2321    #[doc = " *"]
2322    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
2323    #[doc = " * for the relevant operations specified in 6.1.2. When this data structure "]
2324    #[doc = " * is canonicalized, the EccP384CurvePoint in rSig is represented in the "]
2325    #[doc = " * form x-only."]
2326    #[doc = " *"]
2327    #[doc = " * @note When the signature is of form x-only, the x-value in rSig is"]
2328    #[doc = " * an integer mod n, the order of the group; when the signature is of form"]
2329    #[doc = " * compressed-y-\\*, the x-value in rSig is an integer mod p, the underlying"]
2330    #[doc = " * prime defining the finite field. In principle, this means that to convert a "]
2331    #[doc = " * signature from form compressed-y-* to form x-only, the converter checks the"]
2332    #[doc = " * x-value to see if it lies between n and p and reduces it mod n if so. In"]
2333    #[doc = " * practice, this check is unnecessary: Haase's Theorem states that difference"]
2334    #[doc = " * between n and p is always less than 2*square-root(p), and so the chance"]
2335    #[doc = " * that an integer lies between n and p, for a 384-bit curve, is bounded"]
2336    #[doc = " * above by approximately square-root(p)/p or 2^(-192). For the 384-bit curve"]
2337    #[doc = " * in this standard, the exact values of n and p in hexadecimal are:"]
2338    #[doc = " *   - p = 8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123"]
2339    #[doc = " * ACD3A729901D1A71874700133107EC53"]
2340    #[doc = " *   - n = 8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7"]
2341    #[doc = " * CF3AB6AF6B7FC3103B883202E9046565"]
2342    #[doc = " "]
2343    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2344    #[rasn(automatic_tags)]
2345    pub struct EcdsaP384Signature {
2346        #[rasn(identifier = "rSig")]
2347        pub r_sig: EccP384CurvePoint,
2348        #[rasn(size("48"), identifier = "sSig")]
2349        pub s_sig: OctetString,
2350    }
2351    impl EcdsaP384Signature {
2352        pub fn new(r_sig: EccP384CurvePoint, s_sig: OctetString) -> Self {
2353            Self { r_sig, s_sig }
2354        }
2355    }
2356    #[doc = "*"]
2357    #[doc = " * @brief This data structure is used to transfer a 16-byte symmetric key "]
2358    #[doc = " * encrypted using SM2 encryption as specified in 5.3.3. The symmetric key is "]
2359    #[doc = " * input to the key encryption process with no headers, encapsulation, or "]
2360    #[doc = " * length indication. Encryption and decryption are carried out as specified "]
2361    #[doc = " * in 5.3.5.2."]
2362    #[doc = " * "]
2363    #[doc = " * @param v: is the sender's ephemeral public key, which is the output V from"]
2364    #[doc = " * encryption as specified in 5.3.5.2."]
2365    #[doc = " *"]
2366    #[doc = " * @param c: is the encrypted symmetric key, which is the output C from "]
2367    #[doc = " * encryption as specified in 5.3.5.2. The algorithm for the symmetric key "]
2368    #[doc = " * is identified by the CHOICE indicated in the following SymmetricCiphertext. "]
2369    #[doc = " * For SM2 this algorithm shall be SM4."]
2370    #[doc = " *"]
2371    #[doc = " * @param t: is the authentication tag, which is the output tag from"]
2372    #[doc = " * encryption as specified in 5.3.5.2."]
2373    #[doc = " "]
2374    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2375    #[rasn(automatic_tags)]
2376    pub struct EcencP256EncryptedKey {
2377        pub v: EccP256CurvePoint,
2378        #[rasn(size("16"))]
2379        pub c: OctetString,
2380        #[rasn(size("32"))]
2381        pub t: OctetString,
2382    }
2383    impl EcencP256EncryptedKey {
2384        pub fn new(v: EccP256CurvePoint, c: OctetString, t: OctetString) -> Self {
2385            Self { v, c, t }
2386        }
2387    }
2388    #[doc = "*"]
2389    #[doc = " * @brief This data structure is used to transfer a 16-byte symmetric key"]
2390    #[doc = " * encrypted using ECIES as specified in IEEE Std 1363a-2004. The symmetric "]
2391    #[doc = " * key is input to the key encryption process with no headers, encapsulation, "]
2392    #[doc = " * or length indication. Encryption and decryption are carried out as "]
2393    #[doc = " * specified in 5.3.5.1."]
2394    #[doc = " *"]
2395    #[doc = " * @param v: is the sender's ephemeral public key, which is the output V from"]
2396    #[doc = " * encryption as specified in 5.3.5.1."]
2397    #[doc = " *"]
2398    #[doc = " * @param c: is the encrypted symmetric key, which is the output C from "]
2399    #[doc = " * encryption as specified in 5.3.5.1. The algorithm for the symmetric key "]
2400    #[doc = " * is identified by the CHOICE indicated in the following SymmetricCiphertext. "]
2401    #[doc = " * For ECIES this shall be AES-128."]
2402    #[doc = " *"]
2403    #[doc = " * @param t: is the authentication tag, which is the output tag from"]
2404    #[doc = " * encryption as specified in 5.3.5.1."]
2405    #[doc = " "]
2406    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2407    #[rasn(automatic_tags)]
2408    pub struct EciesP256EncryptedKey {
2409        pub v: EccP256CurvePoint,
2410        #[rasn(size("16"))]
2411        pub c: OctetString,
2412        #[rasn(size("16"))]
2413        pub t: OctetString,
2414    }
2415    impl EciesP256EncryptedKey {
2416        pub fn new(v: EccP256CurvePoint, c: OctetString, t: OctetString) -> Self {
2417            Self { v, c, t }
2418        }
2419    }
2420    #[doc = "*"]
2421    #[doc = " * @brief This structure represents a elliptic curve signature where the"]
2422    #[doc = " * component r is constrained to be an integer. This structure supports SM2 "]
2423    #[doc = " * signatures as specified in 5.3.1.3."]
2424    #[doc = " "]
2425    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2426    #[rasn(automatic_tags)]
2427    pub struct EcsigP256Signature {
2428        #[rasn(size("32"), identifier = "rSig")]
2429        pub r_sig: OctetString,
2430        #[rasn(size("32"), identifier = "sSig")]
2431        pub s_sig: OctetString,
2432    }
2433    impl EcsigP256Signature {
2434        pub fn new(r_sig: OctetString, s_sig: OctetString) -> Self {
2435            Self { r_sig, s_sig }
2436        }
2437    }
2438    #[doc = "*"]
2439    #[doc = " * @brief This structure contains an estimate of the geodetic altitude above"]
2440    #[doc = " * or below the WGS84 ellipsoid. The 16-bit value is interpreted as an"]
2441    #[doc = " * integer number of decimeters representing the height above a minimum"]
2442    #[doc = " * height of -409.5 m, with the maximum height being 6143.9 m."]
2443    #[doc = " "]
2444    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2445    #[rasn(delegate)]
2446    pub struct Elevation(pub Uint16);
2447    #[doc = "*"]
2448    #[doc = " * @brief This structure contains an encryption key, which may be a public or"]
2449    #[doc = " * a symmetric key."]
2450    #[doc = " *"]
2451    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
2452    #[doc = " * for the relevant operations specified in 6.1.2 if it appears in a "]
2453    #[doc = " * HeaderInfo or in a ToBeSignedCertificate. The canonicalization applies to"]
2454    #[doc = " * the PublicEncryptionKey. See the definitions of HeaderInfo and "]
2455    #[doc = " * ToBeSignedCertificate for a specification of the canonicalization "]
2456    #[doc = " * operations."]
2457    #[doc = " "]
2458    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2459    #[rasn(choice, automatic_tags)]
2460    pub enum EncryptionKey {
2461        public(PublicEncryptionKey),
2462        symmetric(SymmetricEncryptionKey),
2463    }
2464    #[doc = "*"]
2465    #[doc = " * @brief This type is used as an identifier for instances of ExtContent "]
2466    #[doc = " * within an EXT-TYPE. "]
2467    #[doc = " "]
2468    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2469    #[rasn(delegate, value("0..=255"))]
2470    pub struct ExtId(pub u8);
2471    #[doc = "***************************************************************************"]
2472    #[doc = "                           Location Structures                             "]
2473    #[doc = "***************************************************************************"]
2474    #[doc = "*"]
2475    #[doc = " * @brief This structure represents a geographic region of a specified form."]
2476    #[doc = " * A certificate is not valid if any part of the region indicated in its"]
2477    #[doc = " * scope field lies outside the region indicated in the scope of its issuer."]
2478    #[doc = " *"]
2479    #[doc = " * @param circularRegion: contains a single instance of the CircularRegion"]
2480    #[doc = " * structure."]
2481    #[doc = " *"]
2482    #[doc = " * @param rectangularRegion: is an array of RectangularRegion structures"]
2483    #[doc = " * containing at least one entry. This field is interpreted as a series of"]
2484    #[doc = " * rectangles, which may overlap or be disjoint. The permitted region is any"]
2485    #[doc = " * point within any of the rectangles."]
2486    #[doc = " *"]
2487    #[doc = " * @param polygonalRegion: contains a single instance of the PolygonalRegion"]
2488    #[doc = " * structure."]
2489    #[doc = " *"]
2490    #[doc = " * @param identifiedRegion: is an array of IdentifiedRegion structures"]
2491    #[doc = " * containing at least one entry. The permitted region is any point within"]
2492    #[doc = " * any of the identified regions."]
2493    #[doc = " *"]
2494    #[doc = " * @note Critical information fields:"]
2495    #[doc = " *   - If present, this is a critical information field as defined in 5.2.6."]
2496    #[doc = " * An implementation that does not recognize the indicated CHOICE when"]
2497    #[doc = " * verifying a signed SPDU shall indicate that the signed SPDU is invalid in "]
2498    #[doc = " * the sense of 4.2.2.3.2, that is, it is invalid in the sense that its "]
2499    #[doc = " * validity cannot be established."]
2500    #[doc = " *   - If selected, rectangularRegion is a critical information field as"]
2501    #[doc = " * defined in 5.2.6. An implementation that does not support the number of"]
2502    #[doc = " * RectangularRegion in rectangularRegions when verifying a signed SPDU shall"]
2503    #[doc = " * indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, that "]
2504    #[doc = " * is, it is invalid in the sense that its validity cannot be established. "]
2505    #[doc = " * A conformant implementation shall support rectangularRegions fields "]
2506    #[doc = " * containing at least eight entries."]
2507    #[doc = " *   - If selected, identifiedRegion is a critical information field as"]
2508    #[doc = " * defined in 5.2.6. An implementation that does not support the number of"]
2509    #[doc = " * IdentifiedRegion in identifiedRegion shall reject the signed SPDU as"]
2510    #[doc = " * invalid in the sense of 4.2.2.3.2, that is, it is invalid in the sense "]
2511    #[doc = " * that its validity cannot be established. A conformant implementation shall "]
2512    #[doc = " * support identifiedRegion fields containing at least eight entries."]
2513    #[doc = " "]
2514    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2515    #[rasn(choice, automatic_tags)]
2516    #[non_exhaustive]
2517    pub enum GeographicRegion {
2518        circularRegion(CircularRegion),
2519        rectangularRegion(SequenceOfRectangularRegion),
2520        polygonalRegion(PolygonalRegion),
2521        identifiedRegion(SequenceOfIdentifiedRegion),
2522    }
2523    #[doc = "*"]
2524    #[doc = " * @brief This is the group linkage value. See 5.1.3 and 7.3 for details of"]
2525    #[doc = " * use."]
2526    #[doc = " "]
2527    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2528    #[rasn(automatic_tags)]
2529    pub struct GroupLinkageValue {
2530        #[rasn(size("4"), identifier = "jValue")]
2531        pub j_value: OctetString,
2532        #[rasn(size("9"))]
2533        pub value: OctetString,
2534    }
2535    impl GroupLinkageValue {
2536        pub fn new(j_value: OctetString, value: OctetString) -> Self {
2537            Self { j_value, value }
2538        }
2539    }
2540    #[doc = "*"]
2541    #[doc = " * @brief This structure identifies a hash algorithm. The value sha256, "]
2542    #[doc = " * indicates SHA-256. The value sha384 indicates SHA-384. The value sm3 "]
2543    #[doc = " * indicates SM3. See 5.3.3 for more details."]
2544    #[doc = " *"]
2545    #[doc = " * @note Critical information fields: This is a critical information field as"]
2546    #[doc = " * defined in 5.2.6. An implementation that does not recognize the enumerated"]
2547    #[doc = " * value of this type in a signed SPDU when verifying a signed SPDU shall "]
2548    #[doc = " * indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, that "]
2549    #[doc = " * is, it is invalid in the sense that its validity cannot be established."]
2550    #[doc = " "]
2551    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
2552    #[rasn(enumerated)]
2553    #[non_exhaustive]
2554    pub enum HashAlgorithm {
2555        sha256 = 0,
2556        #[rasn(extension_addition)]
2557        sha384 = 1,
2558        #[rasn(extension_addition)]
2559        sm3 = 2,
2560    }
2561    #[doc = "*"]
2562    #[doc = " * @brief This type contains the truncated hash of another data structure."]
2563    #[doc = " * The HashedId10 for a given data structure is calculated by calculating the"]
2564    #[doc = " * hash of the encoded data structure and taking the low-order ten bytes of"]
2565    #[doc = " * the hash output. The low-order ten bytes are the last ten bytes of the "]
2566    #[doc = " * hash when represented in network byte order. If the data structure"]
2567    #[doc = " * is subject to canonicalization it is canonicalized before hashing. See "]
2568    #[doc = " * Example below."]
2569    #[doc = " *"]
2570    #[doc = " * The hash algorithm to be used to calculate a HashedId10 within a"]
2571    #[doc = " * structure depends on the context. In this standard, for each structure"]
2572    #[doc = " * that includes a HashedId10 field, the corresponding text indicates how the"]
2573    #[doc = " * hash algorithm is determined. See also the discussion in 5.3.9."]
2574    #[doc = " *"]
2575    #[doc = " * Example: Consider the SHA-256 hash of the empty string:"]
2576    #[doc = " *"]
2577    #[doc = " * SHA-256(\"\") ="]
2578    #[doc = " * e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]
2579    #[doc = " *"]
2580    #[doc = " * The HashedId10 derived from this hash corresponds to the following:"]
2581    #[doc = " *"]
2582    #[doc = " * HashedId10 = 934ca495991b7852b855."]
2583    #[doc = " "]
2584    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2585    #[rasn(delegate)]
2586    pub struct HashedId10(pub FixedOctetString<10usize>);
2587    #[doc = "*"]
2588    #[doc = " * @brief This type contains the truncated hash of another data structure."]
2589    #[doc = " * The HashedId3 for a given data structure is calculated by calculating the"]
2590    #[doc = " * hash of the encoded data structure and taking the low-order three bytes of"]
2591    #[doc = " * the hash output. The low-order three bytes are the last three bytes of the"]
2592    #[doc = " * 32-byte hash when represented in network byte order. If the data structure"]
2593    #[doc = " * is subject to canonicalization it is canonicalized before hashing. See "]
2594    #[doc = " * Example below."]
2595    #[doc = " *"]
2596    #[doc = " * The hash algorithm to be used to calculate a HashedId3 within a"]
2597    #[doc = " * structure depends on the context. In this standard, for each structure"]
2598    #[doc = " * that includes a HashedId3 field, the corresponding text indicates how the"]
2599    #[doc = " * hash algorithm is determined. See also the discussion in 5.3.9."]
2600    #[doc = " *"]
2601    #[doc = " * Example: Consider the SHA-256 hash of the empty string:"]
2602    #[doc = " *"]
2603    #[doc = " * SHA-256(\"\") ="]
2604    #[doc = " * e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]
2605    #[doc = " *"]
2606    #[doc = " * The HashedId3 derived from this hash corresponds to the following:"]
2607    #[doc = " *"]
2608    #[doc = " * HashedId3 = 52b855."]
2609    #[doc = " "]
2610    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2611    #[rasn(delegate)]
2612    pub struct HashedId3(pub FixedOctetString<3usize>);
2613    #[doc = "*"]
2614    #[doc = " * @brief This data structure contains the truncated hash of another data"]
2615    #[doc = " * structure. The HashedId32 for a given data structure is calculated by "]
2616    #[doc = " * calculating the hash of the encoded data structure and taking the "]
2617    #[doc = " * low-order 32 bytes of the hash output. The low-order 32 bytes are the last"]
2618    #[doc = " * 32 bytes of the hash when represented in network byte order. If the data "]
2619    #[doc = " * structure is subject to canonicalization it is canonicalized before "]
2620    #[doc = " * hashing. See Example below."]
2621    #[doc = " *"]
2622    #[doc = " * The hash algorithm to be used to calculate a HashedId32 within a"]
2623    #[doc = " * structure depends on the context. In this standard, for each structure"]
2624    #[doc = " * that includes a HashedId32 field, the corresponding text indicates how the"]
2625    #[doc = " * hash algorithm is determined. See also the discussion in 5.3.9."]
2626    #[doc = " *"]
2627    #[doc = " * Example: Consider the SHA-256 hash of the empty string:"]
2628    #[doc = " *"]
2629    #[doc = " * SHA-256(\"\") ="]
2630    #[doc = " * e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]
2631    #[doc = " *"]
2632    #[doc = " * The HashedId32 derived from this hash corresponds to the following:"]
2633    #[doc = " *"]
2634    #[doc = " * HashedId32 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b8"]
2635    #[doc = " * 55."]
2636    #[doc = " "]
2637    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2638    #[rasn(delegate)]
2639    pub struct HashedId32(pub FixedOctetString<32usize>);
2640    #[doc = "*"]
2641    #[doc = " * @brief This data structure contains the truncated hash of another data "]
2642    #[doc = " * structure. The HashedId48 for a given data structure is calculated by"]
2643    #[doc = " * calculating the hash of the encoded data structure and taking the "]
2644    #[doc = " * low-order 48 bytes of the hash output. The low-order 48 bytes are the last"]
2645    #[doc = " * 48 bytes of the hash when represented in network byte order. If the data"]
2646    #[doc = " * structure is subject to canonicalization it is canonicalized before"]
2647    #[doc = " * hashing. See Example below."]
2648    #[doc = " *"]
2649    #[doc = " * The hash algorithm to be used to calculate a HashedId48 within a"]
2650    #[doc = " * structure depends on the context. In this standard, for each structure"]
2651    #[doc = " * that includes a HashedId48 field, the corresponding text indicates how the"]
2652    #[doc = " * hash algorithm is determined. See also the discussion in 5.3.9."]
2653    #[doc = " *"]
2654    #[doc = " * Example: Consider the SHA-384 hash of the empty string:"]
2655    #[doc = " *"]
2656    #[doc = " * SHA-384(\"\") = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6"]
2657    #[doc = " * e1da274edebfe76f65fbd51ad2f14898b95b"]
2658    #[doc = " *"]
2659    #[doc = " * The HashedId48 derived from this hash corresponds to the following:"]
2660    #[doc = " *"]
2661    #[doc = " * HashedId48 = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e"]
2662    #[doc = " * 1da274edebfe76f65fbd51ad2f14898b95b."]
2663    #[doc = " "]
2664    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2665    #[rasn(delegate)]
2666    pub struct HashedId48(pub FixedOctetString<48usize>);
2667    #[doc = "*"]
2668    #[doc = " * @brief This type contains the truncated hash of another data structure."]
2669    #[doc = " * The HashedId8 for a given data structure is calculated by calculating the"]
2670    #[doc = " * hash of the encoded data structure and taking the low-order eight bytes of"]
2671    #[doc = " * the hash output. The low-order eight bytes are the last eight bytes of the"]
2672    #[doc = " * hash when represented in network byte order. If the data structure"]
2673    #[doc = " * is subject to canonicalization it is canonicalized before hashing. See "]
2674    #[doc = " * Example below."]
2675    #[doc = " *"]
2676    #[doc = " * The hash algorithm to be used to calculate a HashedId8 within a"]
2677    #[doc = " * structure depends on the context. In this standard, for each structure"]
2678    #[doc = " * that includes a HashedId8 field, the corresponding text indicates how the"]
2679    #[doc = " * hash algorithm is determined. See also the discussion in 5.3.9."]
2680    #[doc = " *"]
2681    #[doc = " * Example: Consider the SHA-256 hash of the empty string:"]
2682    #[doc = " *"]
2683    #[doc = " * SHA-256(\"\") ="]
2684    #[doc = " * e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"]
2685    #[doc = " *"]
2686    #[doc = " * The HashedId8 derived from this hash corresponds to the following:"]
2687    #[doc = " *"]
2688    #[doc = " * HashedId8 = a495991b7852b855."]
2689    #[doc = " "]
2690    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2691    #[rasn(delegate)]
2692    pub struct HashedId8(pub FixedOctetString<8usize>);
2693    #[doc = "*"]
2694    #[doc = " * @brief This is a UTF-8 string as defined in IETF RFC 3629. The contents"]
2695    #[doc = " * are determined by policy."]
2696    #[doc = " "]
2697    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2698    #[rasn(delegate, size("0..=255"))]
2699    pub struct Hostname(pub Utf8String);
2700    #[doc = "***************************************************************************"]
2701    #[doc = "                             Pseudonym Linkage                             "]
2702    #[doc = "***************************************************************************"]
2703    #[doc = "*"]
2704    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
2705    #[doc = " "]
2706    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2707    #[rasn(delegate)]
2708    pub struct IValue(pub Uint16);
2709    #[doc = "*"]
2710    #[doc = " * @brief This structure indicates the region of validity of a certificate "]
2711    #[doc = " * using region identifiers. "]
2712    #[doc = " * A conformant implementation that supports this type shall support at least "]
2713    #[doc = " * one of the possible CHOICE values. The Protocol Implementation Conformance "]
2714    #[doc = " * Statement (PICS) provided in Annex A allows an implementation to state "]
2715    #[doc = " * which CountryOnly values it recognizes."]
2716    #[doc = " *"]
2717    #[doc = " * @param countryOnly: indicates that only a country (or a geographic entity "]
2718    #[doc = " * included in a country list) is given."]
2719    #[doc = " *"]
2720    #[doc = " * @param countryAndRegions: indicates that one or more top-level regions "]
2721    #[doc = " * within a country (as defined by the region listing associated with that "]
2722    #[doc = " * country) is given."]
2723    #[doc = " *"]
2724    #[doc = " * @param countryAndSubregions: indicates that one or more regions smaller "]
2725    #[doc = " * than the top-level regions within a country (as defined by the region "]
2726    #[doc = " * listing associated with that country) is given."]
2727    #[doc = " *"]
2728    #[doc = " * Critical information fields: If present, this is a critical"]
2729    #[doc = " * information field as defined in 5.2.6. An implementation that does not"]
2730    #[doc = " * recognize the indicated CHOICE when verifying a signed SPDU shall indicate"]
2731    #[doc = " * that the signed SPDU is invalid in the sense of 4.2.2.3.2, that is, it is "]
2732    #[doc = " * invalid in the sense that its validity cannot be established."]
2733    #[doc = " "]
2734    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2735    #[rasn(choice, automatic_tags)]
2736    #[non_exhaustive]
2737    pub enum IdentifiedRegion {
2738        countryOnly(UnCountryId),
2739        countryAndRegions(CountryAndRegions),
2740        countryAndSubregions(CountryAndSubregions),
2741    }
2742    #[doc = "*"]
2743    #[doc = " * @brief The known latitudes are from -900,000,000 to +900,000,000 in 0.1"]
2744    #[doc = " * microdegree intervals."]
2745    #[doc = " "]
2746    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2747    #[rasn(delegate, value("-900000000..=900000000"))]
2748    pub struct KnownLatitude(pub NinetyDegreeInt);
2749    #[doc = "*"]
2750    #[doc = " * @brief The known longitudes are from -1,799,999,999 to +1,800,000,000 in"]
2751    #[doc = " * 0.1 microdegree intervals."]
2752    #[doc = " "]
2753    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2754    #[rasn(delegate, value("-1799999999..=1800000000"))]
2755    pub struct KnownLongitude(pub OneEightyDegreeInt);
2756    #[doc = "*"]
2757    #[doc = " * @brief This structure contains a LA Identifier for use in the algorithms"]
2758    #[doc = " * specified in 5.1.3.4."]
2759    #[doc = " "]
2760    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2761    #[rasn(delegate)]
2762    pub struct LaId(pub FixedOctetString<2usize>);
2763    #[doc = "*"]
2764    #[doc = " * @brief This type contains an INTEGER encoding an estimate of the latitude"]
2765    #[doc = " * with precision 1/10th microdegree relative to the World Geodetic System"]
2766    #[doc = " * (WGS)-84 datum as defined in NIMA Technical Report TR8350.2."]
2767    #[doc = " * The integer in the latitude field is no more than 900 000 000 and no less "]
2768    #[doc = " * than ?900 000 000, except that the value 900 000 001 is used to indicate "]
2769    #[doc = " * the latitude was not available to the sender."]
2770    #[doc = " "]
2771    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2772    #[rasn(delegate)]
2773    pub struct Latitude(pub NinetyDegreeInt);
2774    #[doc = "*"]
2775    #[doc = " * @brief This structure contains a linkage seed value for use in the"]
2776    #[doc = " * algorithms specified in 5.1.3.4."]
2777    #[doc = " "]
2778    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2779    #[rasn(delegate)]
2780    pub struct LinkageSeed(pub FixedOctetString<16usize>);
2781    #[doc = "*"]
2782    #[doc = " * @brief This is the individual linkage value. See 5.1.3 and 7.3 for details"]
2783    #[doc = " * of use."]
2784    #[doc = " "]
2785    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2786    #[rasn(delegate)]
2787    pub struct LinkageValue(pub FixedOctetString<9usize>);
2788    #[doc = "*"]
2789    #[doc = " * @brief This type contains an INTEGER encoding an estimate of the longitude"]
2790    #[doc = " * with precision 1/10th microdegree relative to the World Geodetic System"]
2791    #[doc = " * (WGS)-84 datum as defined in NIMA Technical Report TR8350.2."]
2792    #[doc = " * The integer in the longitude field is no more than 1 800 000 000 and no "]
2793    #[doc = " * less than ?1 799 999 999, except that the value 1 800 000 001 is used to "]
2794    #[doc = " * indicate that the longitude was not available to the sender."]
2795    #[doc = " "]
2796    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2797    #[rasn(delegate)]
2798    pub struct Longitude(pub OneEightyDegreeInt);
2799    #[doc = "*"]
2800    #[doc = " * @brief The integer in the latitude field is no more than 900,000,000 and"]
2801    #[doc = " * no less than -900,000,000, except that the value 900,000,001 is used to"]
2802    #[doc = " * indicate the latitude was not available to the sender."]
2803    #[doc = " "]
2804    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2805    #[rasn(delegate, value("-900000000..=900000001"))]
2806    pub struct NinetyDegreeInt(pub i32);
2807    #[doc = "*"]
2808    #[doc = " * @brief The integer in the longitude field is no more than 1,800,000,000"]
2809    #[doc = " * and no less than -1,799,999,999, except that the value 1,800,000,001 is"]
2810    #[doc = " * used to indicate that the longitude was not available to the sender."]
2811    #[doc = " "]
2812    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2813    #[rasn(delegate, value("-1799999999..=1800000001"))]
2814    pub struct OneEightyDegreeInt(pub i32);
2815    #[doc = "***************************************************************************"]
2816    #[doc = "                            OCTET STRING Types                             "]
2817    #[doc = "***************************************************************************"]
2818    #[doc = "*"]
2819    #[doc = " * @brief This is a synonym for ASN.1 OCTET STRING, and is used in the"]
2820    #[doc = " * definition of other data structures."]
2821    #[doc = " "]
2822    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2823    #[rasn(delegate)]
2824    pub struct Opaque(pub OctetString);
2825    #[doc = "*"]
2826    #[doc = " * @brief This structure defines a region using a series of distinct"]
2827    #[doc = " * geographic points, defined on the surface of the reference ellipsoid. The"]
2828    #[doc = " * region is specified by connecting the points in the order they appear,"]
2829    #[doc = " * with each pair of points connected by the geodesic on the reference"]
2830    #[doc = " * ellipsoid. The polygon is completed by connecting the final point to the"]
2831    #[doc = " * first point. The allowed region is the interior of the polygon and its"]
2832    #[doc = " * boundary."]
2833    #[doc = " *"]
2834    #[doc = " * A point which contains an elevation component is considered to be"]
2835    #[doc = " * within the polygonal region if its horizontal projection onto the"]
2836    #[doc = " * reference ellipsoid lies within the region."]
2837    #[doc = " *"]
2838    #[doc = " * A valid PolygonalRegion contains at least three points. In a valid"]
2839    #[doc = " * PolygonalRegion, the implied lines that make up the sides of the polygon"]
2840    #[doc = " * do not intersect."]
2841    #[doc = " *"]
2842    #[doc = " * @note This type does not support enclaves / exclaves. This might be "]
2843    #[doc = " * addressed in a future version of this standard."]
2844    #[doc = " *"]
2845    #[doc = " * @note Critical information fields: If present, this is a critical"]
2846    #[doc = " * information field as defined in 5.2.6. An implementation that does not"]
2847    #[doc = " * support the number of TwoDLocation in the PolygonalRegion when verifying a"]
2848    #[doc = " * signed SPDU shall indicate that the signed SPDU is invalid. A compliant"]
2849    #[doc = " * implementation shall support PolygonalRegions containing at least eight"]
2850    #[doc = " * TwoDLocation entries."]
2851    #[doc = " "]
2852    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2853    #[rasn(delegate, size("3.."))]
2854    pub struct PolygonalRegion(pub SequenceOf<TwoDLocation>);
2855    #[doc = "*"]
2856    #[doc = " * @brief This type represents the PSID defined in IEEE Std 1609.12."]
2857    #[doc = " "]
2858    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2859    #[rasn(delegate, value("0.."))]
2860    pub struct Psid(pub Integer);
2861    #[doc = "***************************************************************************"]
2862    #[doc = "                              PSID / ITS-AID                               "]
2863    #[doc = "***************************************************************************"]
2864    #[doc = "*"]
2865    #[doc = " * @brief This structure represents the permissions that the certificate "]
2866    #[doc = " * holder has with respect to activities for a single application area, "]
2867    #[doc = " * identified by a Psid. "]
2868    #[doc = " *"]
2869    #[doc = " * @note The determination as to whether the activities are consistent with "]
2870    #[doc = " * the permissions indicated by the PSID and ServiceSpecificPermissions is "]
2871    #[doc = " * made by the SDEE and not by the SDS; the SDS provides the PSID and SSP "]
2872    #[doc = " * information to the SDEE to enable the SDEE to make that determination. "]
2873    #[doc = " * See 5.2.4.3.3 for more information."]
2874    #[doc = " *"]
2875    #[doc = " * @note The SDEE specification is expected to specify what application "]
2876    #[doc = " * activities are permitted by particular ServiceSpecificPermissions values."]
2877    #[doc = " * The SDEE specification is also expected EITHER to specify application "]
2878    #[doc = " * activities that are permitted if the ServiceSpecificPermissions is "]
2879    #[doc = " * omitted, OR to state that the ServiceSpecificPermissions need to always be "]
2880    #[doc = " * present."]
2881    #[doc = " *"]
2882    #[doc = " * @note Consistency with signed SPDU: As noted in 5.1.1,"]
2883    #[doc = " * consistency between the SSP and the signed SPDU is defined by rules"]
2884    #[doc = " * specific to the given PSID and is outside the scope of this standard."]
2885    #[doc = " *"]
2886    #[doc = " * @note Consistency with issuing certificate: If a certificate has an"]
2887    #[doc = " * appPermissions entry A for which the ssp field is omitted, A is consistent"]
2888    #[doc = " * with the issuing certificate if the issuing certificate contains a"]
2889    #[doc = " * PsidSspRange P for which the following holds:"]
2890    #[doc = " *   - The psid field in P is equal to the psid field in A and one of the"]
2891    #[doc = " * following is true:"]
2892    #[doc = " *     - The sspRange field in P indicates all."]
2893    #[doc = " *     - The sspRange field in P indicates opaque and one of the entries in"]
2894    #[doc = " * opaque is an OCTET STRING of length 0."]
2895    #[doc = " *"]
2896    #[doc = " * For consistency rules for other forms of the ssp field, see the"]
2897    #[doc = " * following subclauses."]
2898    #[doc = " "]
2899    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2900    #[rasn(automatic_tags)]
2901    pub struct PsidSsp {
2902        pub psid: Psid,
2903        pub ssp: Option<ServiceSpecificPermissions>,
2904    }
2905    impl PsidSsp {
2906        pub fn new(psid: Psid, ssp: Option<ServiceSpecificPermissions>) -> Self {
2907            Self { psid, ssp }
2908        }
2909    }
2910    #[doc = "*"]
2911    #[doc = " * @brief This structure represents the certificate issuing or requesting"]
2912    #[doc = " * permissions of the certificate holder with respect to one particular set"]
2913    #[doc = " * of application permissions."]
2914    #[doc = " *"]
2915    #[doc = " * @param psid: identifies the application area."]
2916    #[doc = " *"]
2917    #[doc = " * @param sspRange: identifies the SSPs associated with that PSID for which"]
2918    #[doc = " * the holder may issue or request certificates. If sspRange is omitted, the"]
2919    #[doc = " * holder may issue or request certificates for any SSP for that PSID."]
2920    #[doc = " "]
2921    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2922    #[rasn(automatic_tags)]
2923    pub struct PsidSspRange {
2924        pub psid: Psid,
2925        #[rasn(identifier = "sspRange")]
2926        pub ssp_range: Option<SspRange>,
2927    }
2928    impl PsidSspRange {
2929        pub fn new(psid: Psid, ssp_range: Option<SspRange>) -> Self {
2930            Self { psid, ssp_range }
2931        }
2932    }
2933    #[doc = "*"]
2934    #[doc = " * @brief This structure specifies a public encryption key and the associated"]
2935    #[doc = " * symmetric algorithm which is used for bulk data encryption when encrypting"]
2936    #[doc = " * for that public key."]
2937    #[doc = " * "]
2938    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
2939    #[doc = " * for the relevant operations specified in 6.1.2 if it appears in a "]
2940    #[doc = " * HeaderInfo or in a ToBeSignedCertificate. The canonicalization applies to "]
2941    #[doc = " * the BasePublicEncryptionKey. See the definitions of HeaderInfo and "]
2942    #[doc = " * ToBeSignedCertificate for a specification of the canonicalization "]
2943    #[doc = " * operations."]
2944    #[doc = " "]
2945    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2946    #[rasn(automatic_tags)]
2947    pub struct PublicEncryptionKey {
2948        #[rasn(identifier = "supportedSymmAlg")]
2949        pub supported_symm_alg: SymmAlgorithm,
2950        #[rasn(identifier = "publicKey")]
2951        pub public_key: BasePublicEncryptionKey,
2952    }
2953    impl PublicEncryptionKey {
2954        pub fn new(supported_symm_alg: SymmAlgorithm, public_key: BasePublicEncryptionKey) -> Self {
2955            Self {
2956                supported_symm_alg,
2957                public_key,
2958            }
2959        }
2960    }
2961    #[doc = "*"]
2962    #[doc = " * @brief This structure represents a public key and states with what "]
2963    #[doc = " * algorithm the public key is to be used. Cryptographic mechanisms are "]
2964    #[doc = " * defined in 5.3."]
2965    #[doc = " * An EccP256CurvePoint or EccP384CurvePoint within a PublicVerificationKey "]
2966    #[doc = " * structure is invalid if it indicates the choice x-only. "]
2967    #[doc = " *"]
2968    #[doc = " * @note Critical information fields: If present, this is a critical "]
2969    #[doc = " * information field as defined in 5.2.6. An implementation that does not "]
2970    #[doc = " * recognize the indicated CHOICE when verifying a signed SPDU shall indicate "]
2971    #[doc = " * that the signed SPDU is invalid indicate that the signed SPDU is invalid "]
2972    #[doc = " * in the sense of 4.2.2.3.2, that is, it is invalid in the sense that its "]
2973    #[doc = " * validity cannot be established. "]
2974    #[doc = " *"]
2975    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization "]
2976    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization "]
2977    #[doc = " * applies to the EccP256CurvePoint and the Ecc384CurvePoint. Both forms of "]
2978    #[doc = " * point are encoded in compressed form, i.e., such that the choice indicated "]
2979    #[doc = " * within the Ecc*CurvePoint is compressed-y-0 or compressed-y-1."]
2980    #[doc = " "]
2981    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
2982    #[rasn(choice, automatic_tags)]
2983    #[non_exhaustive]
2984    pub enum PublicVerificationKey {
2985        ecdsaNistP256(EccP256CurvePoint),
2986        ecdsaBrainpoolP256r1(EccP256CurvePoint),
2987        #[rasn(extension_addition)]
2988        ecdsaBrainpoolP384r1(EccP384CurvePoint),
2989        #[rasn(extension_addition)]
2990        ecdsaNistP384(EccP384CurvePoint),
2991        #[rasn(extension_addition)]
2992        ecsigSm2(EccP256CurvePoint),
2993    }
2994    #[doc = "*"]
2995    #[doc = " * @brief This structure specifies a �rectangle� on the surface of the WGS84 ellipsoid where the "]
2996    #[doc = " * sides are given by lines of constant latitude or longitude. "]
2997    #[doc = " * A point which contains an elevation component is considered to be within the rectangular region "]
2998    #[doc = " * if its horizontal projection onto the reference ellipsoid lies within the region. "]
2999    #[doc = " * A RectangularRegion is invalid if the northWest value is south of the southEast value, or if the "]
3000    #[doc = " * latitude values in the two points are equal, or if the longitude values in the two points are "]
3001    #[doc = " * equal; otherwise it is valid. A certificate that contains an invalid RectangularRegion is invalid."]
3002    #[doc = " *"]
3003    #[doc = " * @param northWest: is the north-west corner of the rectangle."]
3004    #[doc = " *"]
3005    #[doc = " * @param southEast is the south-east corner of the rectangle."]
3006    #[doc = " "]
3007    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3008    #[rasn(automatic_tags)]
3009    pub struct RectangularRegion {
3010        #[rasn(identifier = "northWest")]
3011        pub north_west: TwoDLocation,
3012        #[rasn(identifier = "southEast")]
3013        pub south_east: TwoDLocation,
3014    }
3015    impl RectangularRegion {
3016        pub fn new(north_west: TwoDLocation, south_east: TwoDLocation) -> Self {
3017            Self {
3018                north_west,
3019                south_east,
3020            }
3021        }
3022    }
3023    #[doc = "*"]
3024    #[doc = " * @brief The meanings of the fields in this structure are to be interpreted"]
3025    #[doc = " * in the context of a country within which the region is located, referred "]
3026    #[doc = " * to as the \"enclosing country\". If this structure is used in a "]
3027    #[doc = " * CountryAndSubregions structure, the enclosing country is the one indicated "]
3028    #[doc = " * by the country field in the CountryAndSubregions structure. If other uses "]
3029    #[doc = " * are defined for this structure in the future, it is anticipated (in the"]
3030    #[doc = " * sense of 4.4) that that definition will include a specification of how the"]
3031    #[doc = " * enclosing country can be determined."]
3032    #[doc = " * If the enclosing country is the United States of America:"]
3033    #[doc = " * - The region field identifies the state or statistically equivalent "]
3034    #[doc = " * entity using the integer version of the 2010 FIPS codes as provided by the"]
3035    #[doc = " * U.S. Census Bureau (see normative references in Clause 0).   "]
3036    #[doc = " * - The values in the subregions field identify the county or county "]
3037    #[doc = " * equivalent entity using the integer version of the 2010 FIPS codes as "]
3038    #[doc = " * provided by the U.S. Census Bureau."]
3039    #[doc = " * If the enclosing country is a different country from the USA, the meaning "]
3040    #[doc = " * of regionAndSubregions is not defined in this version of this standard."]
3041    #[doc = " * A conformant implementation that implements this type shall recognize (in "]
3042    #[doc = " * the sense of \"be able to determine whether a two-dimensional location lies "]
3043    #[doc = " * inside or outside the borders identified by\"), for at least one enclosing"]
3044    #[doc = " * country, at least one value for a region within that country and at least "]
3045    #[doc = " * one subregion for the indicated region. In this version of this standard, "]
3046    #[doc = " * the only means to satisfy this is for a conformant implementation to "]
3047    #[doc = " * recognize, for the USA, at least one of the FIPS state codes for US "]
3048    #[doc = " * states, and at least one of the county codes in at least one of the "]
3049    #[doc = " * recognized states. The Protocol Implementation Conformance Statement "]
3050    #[doc = " * (PICS) provided in Annex A allows an implementation to state which "]
3051    #[doc = " * UnCountryId values it recognizes and which region values are recognized "]
3052    #[doc = " * within that country."]
3053    #[doc = " * If a verifying implementation is required to check that an relevant "]
3054    #[doc = " * geographic information in a signed SPDU is consistent with a certificate "]
3055    #[doc = " * containing one or more instances of this type, then the SDS is permitted "]
3056    #[doc = " * to indicate that the signed SPDU is valid even if some values within "]
3057    #[doc = " * subregions are unrecognized in the sense defined above, so long as the "]
3058    #[doc = " * recognized instances of this type completely contain the relevant "]
3059    #[doc = " * geographic information. Informally, if the recognized values in the "]
3060    #[doc = " * certificate allow the SDS to determine that the SPDU is valid, then it "]
3061    #[doc = " * can make that determination even if there are also unrecognized values "]
3062    #[doc = " * in the certificate. This field is therefore not a \"critical "]
3063    #[doc = " * information field\" as defined in 5.2.6, because unrecognized values are "]
3064    #[doc = " * permitted so long as the validity of the SPDU can be established with the "]
3065    #[doc = " * recognized values. However, as discussed in 5.2.6, the presence of an "]
3066    #[doc = " * unrecognized value in a certificate can make it impossible to determine "]
3067    #[doc = " * whether the certificate is valid and so whether the SPDU is valid."]
3068    #[doc = " * In this structure:"]
3069    #[doc = " *"]
3070    #[doc = " * @param region: identifies a region within a country."]
3071    #[doc = " *"]
3072    #[doc = " * @param subregions: identifies one or more subregions within region. A "]
3073    #[doc = " * conformant implementation that supports RegionAndSubregions shall support "]
3074    #[doc = " * a subregions field containing at least eight entries."]
3075    #[doc = " "]
3076    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3077    #[rasn(automatic_tags)]
3078    pub struct RegionAndSubregions {
3079        pub region: Uint8,
3080        pub subregions: SequenceOfUint16,
3081    }
3082    impl RegionAndSubregions {
3083        pub fn new(region: Uint8, subregions: SequenceOfUint16) -> Self {
3084            Self { region, subregions }
3085        }
3086    }
3087    #[doc = "*"]
3088    #[doc = " * @brief This type is used for clarity of definitions."]
3089    #[doc = " "]
3090    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3091    #[rasn(delegate)]
3092    pub struct SequenceOfHashedId3(pub SequenceOf<HashedId3>);
3093    #[doc = "*"]
3094    #[doc = " * @brief This type is used for clarity of definitions."]
3095    #[doc = " "]
3096    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3097    #[rasn(delegate)]
3098    pub struct SequenceOfIdentifiedRegion(pub SequenceOf<IdentifiedRegion>);
3099    #[doc = "*"]
3100    #[doc = " * @brief This type is used for clarity of definitions."]
3101    #[doc = " "]
3102    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3103    #[rasn(delegate)]
3104    pub struct SequenceOfLinkageSeed(pub SequenceOf<LinkageSeed>);
3105    #[doc = " Anonymous SEQUENCE OF member "]
3106    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3107    #[rasn(delegate, identifier = "OCTET_STRING")]
3108    pub struct AnonymousSequenceOfOctetString(pub OctetString);
3109    #[doc = "*"]
3110    #[doc = " * @brief This type is used for clarity of definitions."]
3111    #[doc = " "]
3112    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3113    #[rasn(delegate)]
3114    pub struct SequenceOfOctetString(pub SequenceOf<AnonymousSequenceOfOctetString>);
3115    #[doc = "*"]
3116    #[doc = " * @brief This type is used for clarity of definitions."]
3117    #[doc = " "]
3118    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3119    #[rasn(delegate)]
3120    pub struct SequenceOfPsid(pub SequenceOf<Psid>);
3121    #[doc = "*"]
3122    #[doc = " * @brief This type is used for clarity of definitions."]
3123    #[doc = " "]
3124    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3125    #[rasn(delegate)]
3126    pub struct SequenceOfPsidSsp(pub SequenceOf<PsidSsp>);
3127    #[doc = "*"]
3128    #[doc = " * @brief This type is used for clarity of definitions."]
3129    #[doc = " "]
3130    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3131    #[rasn(delegate)]
3132    pub struct SequenceOfPsidSspRange(pub SequenceOf<PsidSspRange>);
3133    #[doc = "*"]
3134    #[doc = " * @brief This type is used for clarity of definitions."]
3135    #[doc = " "]
3136    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3137    #[rasn(delegate)]
3138    pub struct SequenceOfRectangularRegion(pub SequenceOf<RectangularRegion>);
3139    #[doc = "*"]
3140    #[doc = " * @brief This type is used for clarity of definitions."]
3141    #[doc = " "]
3142    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3143    #[rasn(delegate)]
3144    pub struct SequenceOfRegionAndSubregions(pub SequenceOf<RegionAndSubregions>);
3145    #[doc = "*"]
3146    #[doc = " * @brief This type is used for clarity of definitions."]
3147    #[doc = " "]
3148    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3149    #[rasn(delegate)]
3150    pub struct SequenceOfUint16(pub SequenceOf<Uint16>);
3151    #[doc = "*"]
3152    #[doc = " * @brief This type is used for clarity of definitions."]
3153    #[doc = " "]
3154    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3155    #[rasn(delegate)]
3156    pub struct SequenceOfUint8(pub SequenceOf<Uint8>);
3157    #[doc = "*"]
3158    #[doc = " * @brief This structure represents the Service Specific Permissions (SSP)"]
3159    #[doc = " * relevant to a given entry in a PsidSsp. The meaning of the SSP is specific"]
3160    #[doc = " * to the associated Psid. SSPs may be PSID-specific octet strings or"]
3161    #[doc = " * bitmap-based. See Annex C for further discussion of how application"]
3162    #[doc = " * specifiers may choose which SSP form to use."]
3163    #[doc = " *"]
3164    #[doc = " * @note Consistency with issuing certificate: If a certificate has an"]
3165    #[doc = " * appPermissions entry A for which the ssp field is opaque, A is consistent"]
3166    #[doc = " * with the issuing certificate if the issuing certificate contains one of"]
3167    #[doc = " * the following:"]
3168    #[doc = " *   - (OPTION 1) A SubjectPermissions field indicating the choice all and"]
3169    #[doc = " * no PsidSspRange field containing the psid field in A;"]
3170    #[doc = " *   - (OPTION 2) A PsidSspRange P for which the following holds:"]
3171    #[doc = " *     - The psid field in P is equal to the psid field in A and one of the"]
3172    #[doc = " * following is true:"]
3173    #[doc = " *       - The sspRange field in P indicates all."]
3174    #[doc = " *       - The sspRange field in P indicates opaque and one of the entries in"]
3175    #[doc = " * the opaque field in P is an OCTET STRING identical to the opaque field in"]
3176    #[doc = " * A."]
3177    #[doc = " *"]
3178    #[doc = " * For consistency rules for other types of ServiceSpecificPermissions,"]
3179    #[doc = " * see the following subclauses."]
3180    #[doc = " "]
3181    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3182    #[rasn(choice, automatic_tags)]
3183    #[non_exhaustive]
3184    pub enum ServiceSpecificPermissions {
3185        opaque(OctetString),
3186        #[rasn(extension_addition)]
3187        bitmapSsp(BitmapSsp),
3188    }
3189    #[doc = "***************************************************************************"]
3190    #[doc = "                            Crypto Structures                              "]
3191    #[doc = "***************************************************************************"]
3192    #[doc = "*"]
3193    #[doc = " * @brief This structure represents a signature for a supported public key"]
3194    #[doc = " * algorithm. It may be contained within SignedData or Certificate."]
3195    #[doc = " *"]
3196    #[doc = " * @note Critical information fields: If present, this is a critical "]
3197    #[doc = " * information field as defined in 5.2.5. An implementation that does not "]
3198    #[doc = " * recognize the indicated CHOICE for this type when verifying a signed SPDU"]
3199    #[doc = " * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2,"]
3200    #[doc = " * that is, it is invalid in the sense that its validity cannot be "]
3201    #[doc = " * established."]
3202    #[doc = " *"]
3203    #[doc = " * @note Canonicalization: This data structure is subject to canonicalization"]
3204    #[doc = " * for the relevant operations specified in 6.1.2. The canonicalization"]
3205    #[doc = " * applies to instances of this data structure of form EcdsaP256Signature"]
3206    #[doc = " * and EcdsaP384Signature."]
3207    #[doc = " "]
3208    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3209    #[rasn(choice, automatic_tags)]
3210    #[non_exhaustive]
3211    pub enum Signature {
3212        ecdsaNistP256Signature(EcdsaP256Signature),
3213        ecdsaBrainpoolP256r1Signature(EcdsaP256Signature),
3214        #[rasn(extension_addition)]
3215        ecdsaBrainpoolP384r1Signature(EcdsaP384Signature),
3216        #[rasn(extension_addition)]
3217        ecdsaNistP384Signature(EcdsaP384Signature),
3218        #[rasn(extension_addition)]
3219        sm2Signature(EcsigP256Signature),
3220    }
3221    #[doc = "*"]
3222    #[doc = " * @brief This structure identifies the SSPs associated with a PSID for"]
3223    #[doc = " * which the holder may issue or request certificates."]
3224    #[doc = " *"]
3225    #[doc = " * @note Consistency with issuing certificate: If a certificate has a"]
3226    #[doc = " * PsidSspRange A for which the ssp field is opaque, A is consistent with"]
3227    #[doc = " * the issuing certificate if the issuing certificate contains one of the"]
3228    #[doc = " * following:"]
3229    #[doc = " *   - (OPTION 1) A SubjectPermissions field indicating the choice all and"]
3230    #[doc = " * no PsidSspRange field containing the psid field in A;"]
3231    #[doc = " *   - (OPTION 2) A PsidSspRange P for which the following holds:"]
3232    #[doc = " *     - The psid field in P is equal to the psid field in A and one of the"]
3233    #[doc = " * following is true:"]
3234    #[doc = " *       - The sspRange field in P indicates all."]
3235    #[doc = " *       - The sspRange field in P indicates opaque, and the sspRange field in"]
3236    #[doc = " * A indicates opaque, and every OCTET STRING within the opaque in A is a"]
3237    #[doc = " * duplicate of an OCTET STRING within the opaque in P."]
3238    #[doc = " *"]
3239    #[doc = " * If a certificate has a PsidSspRange A for which the ssp field is all,"]
3240    #[doc = " * A is consistent with the issuing certificate if the issuing certificate"]
3241    #[doc = " * contains a PsidSspRange P for which the following holds:"]
3242    #[doc = " *   - (OPTION 1) A SubjectPermissions field indicating the choice all and"]
3243    #[doc = " * no PsidSspRange field containing the psid field in A;"]
3244    #[doc = " *   - (OPTION 2) A PsidSspRange P for which the psid field in P is equal to"]
3245    #[doc = " * the psid field in A and the sspRange field in P indicates all."]
3246    #[doc = " *"]
3247    #[doc = " * For consistency rules for other types of SspRange, see the following"]
3248    #[doc = " * subclauses."]
3249    #[doc = " *"]
3250    #[doc = " * @note The choice \"all\" may also be indicated by omitting the"]
3251    #[doc = " * SspRange in the enclosing PsidSspRange structure. Omitting the SspRange is"]
3252    #[doc = " * preferred to explicitly indicating \"all\"."]
3253    #[doc = " "]
3254    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3255    #[rasn(choice, automatic_tags)]
3256    #[non_exhaustive]
3257    pub enum SspRange {
3258        opaque(SequenceOfOctetString),
3259        all(()),
3260        #[rasn(extension_addition)]
3261        bitmapSspRange(BitmapSspRange),
3262    }
3263    #[doc = "***************************************************************************"]
3264    #[doc = "                          Certificate Components                           "]
3265    #[doc = "***************************************************************************"]
3266    #[doc = "*"]
3267    #[doc = " * @brief This field contains the certificate holder's assurance level, which"]
3268    #[doc = " * indicates the security of both the platform and storage of secret keys as"]
3269    #[doc = " * well as the confidence in this assessment."]
3270    #[doc = " *"]
3271    #[doc = " * This field is encoded as defined in Table 1, where \"A\" denotes bit"]
3272    #[doc = " * fields specifying an assurance level, \"R\" reserved bit fields, and \"C\" bit"]
3273    #[doc = " * fields specifying the confidence."]
3274    #[doc = " *"]
3275    #[doc = " * Table 1: Bitwise encoding of subject assurance"]
3276    #[doc = " *"]
3277    #[doc = " * | Bit number     |  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |"]
3278    #[doc = " * | -------------- | --- | --- | --- | --- | --- | --- | --- | --- |"]
3279    #[doc = " * | Interpretation |  A  |  A  |  A  |  R  |  R  |  R  |  C  |  C  |"]
3280    #[doc = " *"]
3281    #[doc = " * In Table 1, bit number 0 denotes the least significant bit. Bit 7"]
3282    #[doc = " * to bit 5 denote the device's assurance levels, bit 4 to bit 2 are reserved"]
3283    #[doc = " * for future use, and bit 1 and bit 0 denote the confidence."]
3284    #[doc = " *"]
3285    #[doc = " * The specification of these assurance levels as well as the"]
3286    #[doc = " * encoding of the confidence levels is outside the scope of this"]
3287    #[doc = " * standard. It can be assumed that a higher assurance value indicates that"]
3288    #[doc = " * the holder is more trusted than the holder of a certificate with lower"]
3289    #[doc = " * assurance value and the same confidence value."]
3290    #[doc = " *"]
3291    #[doc = " * @note This field was originally specified in ETSI TS 103 097, and"]
3292    #[doc = " * future uses of this field are anticipated to be consistent with future"]
3293    #[doc = " * versions of that standard."]
3294    #[doc = " "]
3295    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3296    #[rasn(delegate)]
3297    pub struct SubjectAssurance(pub FixedOctetString<1usize>);
3298    #[doc = "*"]
3299    #[doc = " * @brief This enumerated value indicates supported symmetric algorithms. The"]
3300    #[doc = " * algorithm identifier identifies both the algorithm itself and a specific"]
3301    #[doc = " * mode of operation. The symmetric algorithms supported in this version of"]
3302    #[doc = " * this standard are AES-128 and SM4. The only mode of operation supported is"]
3303    #[doc = " * Counter Mode Encryption With Cipher Block Chaining Message Authentication"]
3304    #[doc = " * Code (CCM). Full details are given in 5.3.8."]
3305    #[doc = " "]
3306    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
3307    #[rasn(enumerated)]
3308    #[non_exhaustive]
3309    pub enum SymmAlgorithm {
3310        aes128Ccm = 0,
3311        #[rasn(extension_addition)]
3312        sm4Ccm = 1,
3313    }
3314    #[doc = "*"]
3315    #[doc = " * @brief This structure provides the key bytes for use with an identified "]
3316    #[doc = " * symmetric algorithm. The supported symmetric algorithms are AES-128 and "]
3317    #[doc = " * SM4 in CCM mode as specified in 5.3.8."]
3318    #[doc = " "]
3319    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3320    #[rasn(choice, automatic_tags)]
3321    #[non_exhaustive]
3322    pub enum SymmetricEncryptionKey {
3323        #[rasn(size("16"))]
3324        aes128Ccm(OctetString),
3325        #[rasn(extension_addition, size("16"))]
3326        sm4Ccm(OctetString),
3327    }
3328    #[doc = "*"]
3329    #[doc = " * @brief This structure contains an estimate of 3D location. "]
3330    #[doc = " *"]
3331    #[doc = " * @note The units used in this data structure are consistent with the "]
3332    #[doc = " * location data structures used in \tSAE J2735 [B26], though the encoding is"]
3333    #[doc = " * incompatible."]
3334    #[doc = " "]
3335    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3336    #[rasn(automatic_tags)]
3337    pub struct ThreeDLocation {
3338        pub latitude: Latitude,
3339        pub longitude: Longitude,
3340        pub elevation: Elevation,
3341    }
3342    impl ThreeDLocation {
3343        pub fn new(latitude: Latitude, longitude: Longitude, elevation: Elevation) -> Self {
3344            Self {
3345                latitude,
3346                longitude,
3347                elevation,
3348            }
3349        }
3350    }
3351    #[doc = "***************************************************************************"]
3352    #[doc = "                             Time Structures                               "]
3353    #[doc = "***************************************************************************"]
3354    #[doc = "*"]
3355    #[doc = " * @brief This type gives the number of (TAI) seconds since 00:00:00 UTC, 1"]
3356    #[doc = " * January 2004."]
3357    #[doc = " "]
3358    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3359    #[rasn(delegate)]
3360    pub struct Time32(pub Uint32);
3361    #[doc = "*"]
3362    #[doc = " * @brief This data structure is a 64-bit integer giving an estimate of the "]
3363    #[doc = " * number of (TAI) microseconds since 00:00:00 UTC, 1 January 2004."]
3364    #[doc = " "]
3365    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3366    #[rasn(delegate)]
3367    pub struct Time64(pub Uint64);
3368    #[doc = "*"]
3369    #[doc = " * @brief This structure is used to define validity regions for use in"]
3370    #[doc = " * certificates. The latitude and longitude fields contain the latitude and"]
3371    #[doc = " * longitude as defined above."]
3372    #[doc = " *"]
3373    #[doc = " * @note This data structure is consistent with the location encoding"]
3374    #[doc = " * used in SAE J2735, except that values 900 000 001 for latitude (used to"]
3375    #[doc = " * indicate that the latitude was not available) and 1 800 000 001 for"]
3376    #[doc = " * longitude (used to indicate that the longitude was not available) are not"]
3377    #[doc = " * valid."]
3378    #[doc = " "]
3379    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3380    #[rasn(automatic_tags)]
3381    pub struct TwoDLocation {
3382        pub latitude: Latitude,
3383        pub longitude: Longitude,
3384    }
3385    impl TwoDLocation {
3386        pub fn new(latitude: Latitude, longitude: Longitude) -> Self {
3387            Self {
3388                latitude,
3389                longitude,
3390            }
3391        }
3392    }
3393    #[doc = "*"]
3394    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
3395    #[doc = " * It is for non-negative integers up to 65,535, i.e., (hex)ff ff."]
3396    #[doc = " "]
3397    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3398    #[rasn(delegate, value("0..=65535"))]
3399    pub struct Uint16(pub u16);
3400    #[doc = "***************************************************************************"]
3401    #[doc = "                               Integer Types                               "]
3402    #[doc = "***************************************************************************"]
3403    #[doc = "*"]
3404    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
3405    #[doc = " * It is for non-negative integers up to 7, i.e., (hex)07."]
3406    #[doc = " "]
3407    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3408    #[rasn(delegate, value("0..=7"))]
3409    pub struct Uint3(pub u8);
3410    #[doc = "*"]
3411    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
3412    #[doc = " * It is for non-negative integers up to 4,294,967,295, i.e.,"]
3413    #[doc = " * (hex)ff ff ff ff."]
3414    #[doc = " "]
3415    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3416    #[rasn(delegate, value("0..=4294967295"))]
3417    pub struct Uint32(pub u32);
3418    #[doc = "*"]
3419    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
3420    #[doc = " * It is for non-negative integers up to 18,446,744,073,709,551,615, i.e.,"]
3421    #[doc = " * (hex)ff ff ff ff ff ff ff ff."]
3422    #[doc = " "]
3423    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3424    #[rasn(delegate, value("0..=18446744073709551615"))]
3425    pub struct Uint64(pub u64);
3426    #[doc = "*"]
3427    #[doc = " * @brief This atomic type is used in the definition of other data structures."]
3428    #[doc = " * It is for non-negative integers up to 255, i.e., (hex)ff."]
3429    #[doc = " "]
3430    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3431    #[rasn(delegate, value("0..=255"))]
3432    pub struct Uint8(pub u8);
3433    #[doc = "*"]
3434    #[doc = " * @brief This type contains the integer representation of the country or "]
3435    #[doc = " * area identifier as defined by the United Nations Statistics Division in "]
3436    #[doc = " * October 2013 (see normative references in Clause 0)."]
3437    #[doc = " * A conformant implementation that implements IdentifiedRegion shall "]
3438    #[doc = " * recognize (in the sense of �be able to determine whether a two dimensional "]
3439    #[doc = " * location lies inside or outside the borders identified by�) at least one "]
3440    #[doc = " * value of UnCountryId. The Protocol Implementation Conformance Statement "]
3441    #[doc = " * (PICS) provided in Annex A allows an implementation to state which "]
3442    #[doc = " * UnCountryId values it recognizes."]
3443    #[doc = " * Since 2013 and before the publication of this version of this standard, "]
3444    #[doc = " * three changes have been made to the country code list, to define the "]
3445    #[doc = " * region \"sub-Saharan Africa\" and remove the \"developed regions\", and "]
3446    #[doc = " * \"developing regions\". A conformant implementation may recognize these "]
3447    #[doc = " * region identifiers in the sense defined in the previous paragraph."]
3448    #[doc = " * If a verifying implementation is required to check that relevant "]
3449    #[doc = " * geographic information in a signed SPDU is consistent with a certificate "]
3450    #[doc = " * containing one or more instances of this type, then the SDS is permitted "]
3451    #[doc = " * to indicate that the signed SPDU is valid even if some instances of this "]
3452    #[doc = " * type are unrecognized in the sense defined above, so long as the "]
3453    #[doc = " * recognized instances of this type completely contain the relevant "]
3454    #[doc = " * geographic information. Informally, if the recognized values in the "]
3455    #[doc = " * certificate allow the SDS to determine that the SPDU is valid, then it "]
3456    #[doc = " * can make that determination even if there are also unrecognized values in "]
3457    #[doc = " * the certificate. This field is therefore not a \"critical information "]
3458    #[doc = " * field\" as defined in 5.2.6, because unrecognized values are permitted so "]
3459    #[doc = " * long as the validity of the SPDU can be established with the recognized "]
3460    #[doc = " * values. However, as discussed in 5.2.6, the presence of an unrecognized "]
3461    #[doc = " * value in a certificate can make it impossible to determine whether the "]
3462    #[doc = " * certificate and the SPDU are valid."]
3463    #[doc = " "]
3464    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3465    #[rasn(delegate)]
3466    pub struct UnCountryId(pub Uint16);
3467    #[doc = "*"]
3468    #[doc = " * @brief The value 900,000,001 indicates that the latitude was not"]
3469    #[doc = " * available to the sender."]
3470    #[doc = " "]
3471    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3472    #[rasn(delegate, value("900000001"))]
3473    pub struct UnknownLatitude(pub NinetyDegreeInt);
3474    #[doc = "*"]
3475    #[doc = " * @brief The value 1,800,000,001 indicates that the longitude was not"]
3476    #[doc = " * available to the sender."]
3477    #[doc = " "]
3478    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3479    #[rasn(delegate, value("1800000001"))]
3480    pub struct UnknownLongitude(pub OneEightyDegreeInt);
3481    #[doc = "*"]
3482    #[doc = " * @brief This type gives the validity period of a certificate. The start of "]
3483    #[doc = " * the validity period is given by start and the end is given by "]
3484    #[doc = " * start + duration."]
3485    #[doc = " "]
3486    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3487    #[rasn(automatic_tags)]
3488    pub struct ValidityPeriod {
3489        pub start: Time32,
3490        pub duration: Duration,
3491    }
3492    impl ValidityPeriod {
3493        pub fn new(start: Time32, duration: Duration) -> Self {
3494            Self { start, duration }
3495        }
3496    }
3497}
3498#[allow(
3499    non_camel_case_types,
3500    non_snake_case,
3501    non_upper_case_globals,
3502    unused,
3503    clippy::too_many_arguments
3504)]
3505pub mod ieee1609_dot2_crl {
3506    extern crate alloc;
3507    use super::ieee1609_dot2::Ieee1609Dot2Data;
3508    use super::ieee1609_dot2_base_types::{Opaque, Psid};
3509    use super::ieee1609_dot2_crl_base_types::CrlContents;
3510    use core::borrow::Borrow;
3511    use rasn::prelude::*;
3512    use std::sync::LazyLock;
3513    #[doc = "*"]
3514    #[doc = " * @brief This is the PSID for the CRL application."]
3515    #[doc = " "]
3516    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3517    #[rasn(delegate, value("256"))]
3518    pub struct CrlPsid(pub Psid);
3519    #[doc = "*"]
3520    #[doc = " * @brief This structure is the SPDU used to contain a signed CRL. A valid "]
3521    #[doc = " * signed CRL meets the validity criteria of 7.4."]
3522    #[doc = " "]
3523    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3524    #[rasn(delegate)]
3525    pub struct SecuredCrl(pub Ieee1609Dot2Data);
3526}
3527#[allow(
3528    non_camel_case_types,
3529    non_snake_case,
3530    non_upper_case_globals,
3531    unused,
3532    clippy::too_many_arguments
3533)]
3534pub mod ieee1609_dot2_crl_base_types {
3535    extern crate alloc;
3536    use super::ieee1609_dot2_base_types::{
3537        CrlSeries, Duration, GeographicRegion, HashedId10, HashedId8, IValue, LaId, LinkageSeed,
3538        Opaque, Psid, SequenceOfLinkageSeed, Signature, Time32, Uint16, Uint3, Uint32, Uint8,
3539        ValidityPeriod,
3540    };
3541    use core::borrow::Borrow;
3542    use rasn::prelude::*;
3543    use std::sync::LazyLock;
3544    #[doc = "*"]
3545    #[doc = " * @brief The fields in this structure have the following meaning:"]
3546    #[doc = " *"]
3547    #[doc = " * @param version: is the version number of the CRL. For this version of this"]
3548    #[doc = " * standard it is 1."]
3549    #[doc = " *"]
3550    #[doc = " * @param crlSeries: represents the CRL series to which this CRL belongs. This"]
3551    #[doc = " * is used to determine whether the revocation information in a CRL is relevant"]
3552    #[doc = " * to a particular certificate as specified in 5.1.3.2."]
3553    #[doc = " *"]
3554    #[doc = " * @param crlCraca: contains the low-order eight octets of the hash of the"]
3555    #[doc = " * certificate of the Certificate Revocation Authorization CA (CRACA) that"]
3556    #[doc = " * ultimately authorized the issuance of this CRL. This is used to determine"]
3557    #[doc = " * whether the revocation information in a CRL is relevant to a particular"]
3558    #[doc = " * certificate as specified in 5.1.3.2. In a valid signed CRL as specified in"]
3559    #[doc = " * 7.4 the crlCraca is consistent with the associatedCraca field in the"]
3560    #[doc = " * Service Specific Permissions as defined in 7.4.3.3. The HashedId8 is"]
3561    #[doc = " * calculated with the whole-certificate hash algorithm, determined as"]
3562    #[doc = " * described in 6.4.3, applied to the COER-encoded certificate, canonicalized "]
3563    #[doc = " * as defined in the definition of Certificate."]
3564    #[doc = " *"]
3565    #[doc = " * @param issueDate: specifies the time when the CRL was issued."]
3566    #[doc = " *"]
3567    #[doc = " * @param nextCrl: contains the time when the next CRL with the same crlSeries"]
3568    #[doc = " * and cracaId is expected to be issued. The CRL is invalid unless nextCrl is"]
3569    #[doc = " * strictly after issueDate. This field is used to set the expected update time"]
3570    #[doc = " * for revocation information associated with the (crlCraca, crlSeries) pair as"]
3571    #[doc = " * specified in 5.1.3.6."]
3572    #[doc = " *"]
3573    #[doc = " * @param priorityInfo: contains information that assists devices with limited"]
3574    #[doc = " * storage space in determining which revocation information to retain and"]
3575    #[doc = " * which to discard."]
3576    #[doc = " *"]
3577    #[doc = " * @param\ttypeSpecific: contains the CRL body."]
3578    #[doc = " "]
3579    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3580    #[rasn(automatic_tags)]
3581    pub struct CrlContents {
3582        #[rasn(value("1"))]
3583        pub version: Uint8,
3584        #[rasn(identifier = "crlSeries")]
3585        pub crl_series: CrlSeries,
3586        #[rasn(identifier = "crlCraca")]
3587        pub crl_craca: HashedId8,
3588        #[rasn(identifier = "issueDate")]
3589        pub issue_date: Time32,
3590        #[rasn(identifier = "nextCrl")]
3591        pub next_crl: Time32,
3592        #[rasn(identifier = "priorityInfo")]
3593        pub priority_info: CrlPriorityInfo,
3594        #[rasn(identifier = "typeSpecific")]
3595        pub type_specific: TypeSpecificCrlContents,
3596    }
3597    impl CrlContents {
3598        pub fn new(
3599            version: Uint8,
3600            crl_series: CrlSeries,
3601            crl_craca: HashedId8,
3602            issue_date: Time32,
3603            next_crl: Time32,
3604            priority_info: CrlPriorityInfo,
3605            type_specific: TypeSpecificCrlContents,
3606        ) -> Self {
3607            Self {
3608                version,
3609                crl_series,
3610                crl_craca,
3611                issue_date,
3612                next_crl,
3613                priority_info,
3614                type_specific,
3615            }
3616        }
3617    }
3618    #[doc = "*"]
3619    #[doc = " * @brief This data structure contains information that assists devices with"]
3620    #[doc = " * limited storage space in determining which revocation information to retain"]
3621    #[doc = " * and which to discard."]
3622    #[doc = " *"]
3623    #[doc = " * @param priority: indicates the priority of the revocation information"]
3624    #[doc = " * relative to other CRLs issued for certificates with the same cracaId and"]
3625    #[doc = " * crlSeries values. A higher value for this field indicates higher importance"]
3626    #[doc = " * of this revocation information."]
3627    #[doc = " *"]
3628    #[doc = " * @note This mechanism is for future use; details are not specified in this"]
3629    #[doc = " * version of the standard."]
3630    #[doc = " "]
3631    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3632    #[rasn(automatic_tags)]
3633    #[non_exhaustive]
3634    pub struct CrlPriorityInfo {
3635        pub priority: Option<Uint8>,
3636    }
3637    impl CrlPriorityInfo {
3638        pub fn new(priority: Option<Uint8>) -> Self {
3639            Self { priority }
3640        }
3641    }
3642    #[doc = "*"]
3643    #[doc = " * @brief This structure contains an identifier for the algorithms specified "]
3644    #[doc = " * in 5.1.3.4."]
3645    #[doc = " "]
3646    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
3647    #[rasn(enumerated)]
3648    #[non_exhaustive]
3649    pub enum ExpansionAlgorithmIdentifier {
3650        #[rasn(identifier = "sha256ForI-aesForJ")]
3651        sha256ForI_aesForJ = 0,
3652        #[rasn(identifier = "sm3ForI-sm4ForJ")]
3653        sm3ForI_sm4ForJ = 1,
3654    }
3655    #[doc = "*"]
3656    #[doc = " * @brief In this structure:"]
3657    #[doc = " *"]
3658    #[doc = " * @param iMax: indicates that for these certificates, revocation information "]
3659    #[doc = " * need no longer be calculated once iCert > iMax as the holders are known "]
3660    #[doc = " * to have no more valid certs for that (crlCraca, crlSeries) at that point."]
3661    #[doc = " *"]
3662    #[doc = " * @param la1Id: is the value LinkageAuthorityIdentifier1 used in the "]
3663    #[doc = " * algorithm given in 5.1.3.4. This value applies to all linkage-based "]
3664    #[doc = " * revocation information included within contents."]
3665    #[doc = " *"]
3666    #[doc = " * @param linkageSeed1: is the value LinkageSeed1 used in the algorithm given "]
3667    #[doc = " * in 5.1.3.4."]
3668    #[doc = " *"]
3669    #[doc = " * @param la2Id: is the value LinkageAuthorityIdentifier2 used in the "]
3670    #[doc = " * algorithm given in 5.1.3.4. This value applies to all linkage-based "]
3671    #[doc = " * revocation information included within contents."]
3672    #[doc = " *"]
3673    #[doc = " * @param linkageSeed2: is the value LinkageSeed2 used in the algorithm given "]
3674    #[doc = " * in 5.1.3.4."]
3675    #[doc = " "]
3676    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3677    #[rasn(automatic_tags)]
3678    #[non_exhaustive]
3679    pub struct GroupCrlEntry {
3680        #[rasn(identifier = "iMax")]
3681        pub i_max: Uint16,
3682        #[rasn(identifier = "la1Id")]
3683        pub la1_id: LaId,
3684        #[rasn(identifier = "linkageSeed1")]
3685        pub linkage_seed1: LinkageSeed,
3686        #[rasn(identifier = "la2Id")]
3687        pub la2_id: LaId,
3688        #[rasn(identifier = "linkageSeed2")]
3689        pub linkage_seed2: LinkageSeed,
3690    }
3691    impl GroupCrlEntry {
3692        pub fn new(
3693            i_max: Uint16,
3694            la1_id: LaId,
3695            linkage_seed1: LinkageSeed,
3696            la2_id: LaId,
3697            linkage_seed2: LinkageSeed,
3698        ) -> Self {
3699            Self {
3700                i_max,
3701                la1_id,
3702                linkage_seed1,
3703                la2_id,
3704                linkage_seed2,
3705            }
3706        }
3707    }
3708    #[doc = "*"]
3709    #[doc = " * @brief This structure contains the linkage seed for group revocation with "]
3710    #[doc = " * a single seed. The seed is used as specified in the algorithms in 5.1.3.4."]
3711    #[doc = " "]
3712    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3713    #[rasn(automatic_tags)]
3714    pub struct GroupSingleSeedCrlEntry {
3715        #[rasn(identifier = "iMax")]
3716        pub i_max: Uint16,
3717        #[rasn(identifier = "laId")]
3718        pub la_id: LaId,
3719        #[rasn(identifier = "linkageSeed")]
3720        pub linkage_seed: LinkageSeed,
3721    }
3722    impl GroupSingleSeedCrlEntry {
3723        pub fn new(i_max: Uint16, la_id: LaId, linkage_seed: LinkageSeed) -> Self {
3724            Self {
3725                i_max,
3726                la_id,
3727                linkage_seed,
3728            }
3729        }
3730    }
3731    #[doc = "*"]
3732    #[doc = " * @brief In this structure:"]
3733    #[doc = " *"]
3734    #[doc = " * @param\tid: is the HashedId10 identifying the revoked certificate. The "]
3735    #[doc = " * HashedId10 is calculated with the whole-certificate hash algorithm, "]
3736    #[doc = " * determined as described in 6.4.3, applied to the COER-encoded certificate,"]
3737    #[doc = " * canonicalized as defined in the definition of Certificate."]
3738    #[doc = " *"]
3739    #[doc = " * @param expiry: is the value computed from the validity period's start and"]
3740    #[doc = " * duration values in that certificate."]
3741    #[doc = " "]
3742    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3743    #[rasn(automatic_tags)]
3744    #[non_exhaustive]
3745    pub struct HashBasedRevocationInfo {
3746        pub id: HashedId10,
3747        pub expiry: Time32,
3748    }
3749    impl HashBasedRevocationInfo {
3750        pub fn new(id: HashedId10, expiry: Time32) -> Self {
3751            Self { id, expiry }
3752        }
3753    }
3754    #[doc = "*"]
3755    #[doc = " * @brief In this structure:"]
3756    #[doc = " *"]
3757    #[doc = " * @param iMax indicates that for the entries in contents, revocation "]
3758    #[doc = " * information need no longer be calculated once iCert > iMax as the holder "]
3759    #[doc = " * is known to have no more valid certs at that point. iMax is not directly "]
3760    #[doc = " * used in the calculation of the linkage values, it is used to determine "]
3761    #[doc = " * when revocation information can safely be deleted."]
3762    #[doc = " *"]
3763    #[doc = " * @param contents contains individual linkage data for certificates that are "]
3764    #[doc = " * revoked using two seeds, per the algorithm given in per the mechanisms "]
3765    #[doc = " * given in 5.1.3.4 and with seedEvolutionFunctionIdentifier and "]
3766    #[doc = " * linkageValueGenerationFunctionIdentifier obtained as specified in 7.3.3."]
3767    #[doc = " *"]
3768    #[doc = " * @param singleSeed contains individual linkage data for certificates that "]
3769    #[doc = " * are revoked using a single seed, per the algorithm given in per the "]
3770    #[doc = " * mechanisms given in 5.1.3.4 and with seedEvolutionFunctionIdentifier and "]
3771    #[doc = " * linkageValueGenerationFunctionIdentifier obtained as specified in 7.3.3."]
3772    #[doc = " "]
3773    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3774    #[rasn(automatic_tags)]
3775    #[non_exhaustive]
3776    pub struct IMaxGroup {
3777        #[rasn(identifier = "iMax")]
3778        pub i_max: Uint16,
3779        pub contents: SequenceOfIndividualRevocation,
3780        #[rasn(extension_addition, identifier = "singleSeed")]
3781        pub single_seed: Option<SequenceOfLinkageSeed>,
3782    }
3783    impl IMaxGroup {
3784        pub fn new(
3785            i_max: Uint16,
3786            contents: SequenceOfIndividualRevocation,
3787            single_seed: Option<SequenceOfLinkageSeed>,
3788        ) -> Self {
3789            Self {
3790                i_max,
3791                contents,
3792                single_seed,
3793            }
3794        }
3795    }
3796    #[doc = "*"]
3797    #[doc = " * @brief This structure contains information about when future revocation"]
3798    #[doc = " * time periods start. Revocation time periods are discussed in 5.1.3.4."]
3799    #[doc = " * Linkage value based CRLs contain linkage seeds which can be used to"]
3800    #[doc = " * calculate the linkage values that will appear in certificates for"]
3801    #[doc = " * revocation time periods that are in the future relative to the issuance"]
3802    #[doc = " * time of the CRL; the IPeriodInfo structure allows the CRL signer to"]
3803    #[doc = " * communicate the start time for future time periods, so that a CRL recipient"]
3804    #[doc = " * can calculate the linkage values before the relevant time period starts."]
3805    #[doc = " * The CRL contains a SEQUENCE of IPeriodInfo to support the case where the"]
3806    #[doc = " * CRL issuer knows that the duration of the time periods is going to change"]
3807    #[doc = " * at some point in the future; the number of IPeriodInfo in the sequence"]
3808    #[doc = " * should be the minimum necessary to convey the information, e.g. if the"]
3809    #[doc = " * duration of the time periods is not going to change, the CRL should contain"]
3810    #[doc = " * a single IPeriodInfo."]
3811    #[doc = " * "]
3812    #[doc = " * @note The information about the duration of future time periods can be"]
3813    #[doc = " * assumed to be available to the CRL signer, because pseudonym certificates"]
3814    #[doc = " * that use linkage values are typically issued for future time periods rather"]
3815    #[doc = " * than only the current time period, and so the length of future time periods"]
3816    #[doc = " * had to be known to the CA at the time of certificate issuance and can be"]
3817    #[doc = " * provided to the CRL signer. This creates a requirement that if multiple CAs"]
3818    #[doc = " * issue certificates that use the same CRL Series and CRACA Id values, all of"]
3819    #[doc = " * those CAs will be expected to implement any time period length changes in"]
3820    #[doc = " * synch with each other so that all certificates on the same CRL will have"]
3821    #[doc = " * synchronized time period starts and ends. How these CAs are synchronized"]
3822    #[doc = " * with each other is out of scope for this document."]
3823    #[doc = " * "]
3824    #[doc = " * An IPeriodInfo appears in a CRL that has an iRev field. The CRL contains a"]
3825    #[doc = " * SEQUENCE of IPeriodInfo. Each IPeriodInfo makes use of the previous iRev"]
3826    #[doc = " * value, prevI. For the first IPeriodInfo in the SEQUENCE, prevI is the value"]
3827    #[doc = " * of iRev in the CRL. For each subsequent IPeriodInfo in the SEQUENCE, prevI"]
3828    #[doc = " * is the value of guaranteedToIValue in the previous IPeriodInfo. "]
3829    #[doc = " * "]
3830    #[doc = " * In this structure:"]
3831    #[doc = " *"]
3832    #[doc = " * @param startOfNextIPeriod is the start time of the i-period with i = prevI +"]
3833    #[doc = " * 1. This is the earliest time at which certificates with i-period equal to"]
3834    #[doc = " * prevI + 1 will be valid, i.e. if a certificate with the cracaId and"]
3835    #[doc = " * crlSeries corresponding to this CRL has"]
3836    #[doc = " * ToBeSignedCertificate.id.linkageData.iCert = prevI + 1, then"]
3837    #[doc = " * ToBeSignedCertificate.validityPeriod.start will be no earlier than this"]
3838    #[doc = " * startOfNextIPeriod value."]
3839    #[doc = " *"]
3840    #[doc = " * @param iPeriodLength is the length of all time periods from prevI + 1 to"]
3841    #[doc = " * guaranteedToIValue inclusive, i.e., each time period starts exactly"]
3842    #[doc = " * iPeriodLength after the previous time period started."]
3843    #[doc = " *"]
3844    #[doc = " * @param guaranteedToIValue is last i-period which is guaranteed to have the"]
3845    #[doc = " * indicated duration, i.e., all time periods from prevI + 1 to"]
3846    #[doc = " * guaranteedToIValue are guaranteed to have that duration and time period"]
3847    #[doc = " * guaranteedToIValue +1 is not guaranteed to have that duration."]
3848    #[doc = " "]
3849    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3850    #[rasn(automatic_tags)]
3851    pub struct IPeriodInfo {
3852        #[rasn(identifier = "startOfNextIPeriod")]
3853        pub start_of_next_iperiod: Time32,
3854        #[rasn(identifier = "iPeriodLength")]
3855        pub i_period_length: Duration,
3856        #[rasn(identifier = "guaranteedToIValue")]
3857        pub guaranteed_to_ivalue: IValue,
3858    }
3859    impl IPeriodInfo {
3860        pub fn new(
3861            start_of_next_iperiod: Time32,
3862            i_period_length: Duration,
3863            guaranteed_to_ivalue: IValue,
3864        ) -> Self {
3865            Self {
3866                start_of_next_iperiod,
3867                i_period_length,
3868                guaranteed_to_ivalue,
3869            }
3870        }
3871    }
3872    #[doc = "*"]
3873    #[doc = " * @brief In this structure:"]
3874    #[doc = " *"]
3875    #[doc = " * @param linkageSeed1 is the value LinkageSeed1 used in the algorithm given "]
3876    #[doc = " * in 5.1.3.4."]
3877    #[doc = " *"]
3878    #[doc = " * @param linkageSeed2 is the value LinkageSeed2 used in the algorithm given "]
3879    #[doc = " * in 5.1.3.4."]
3880    #[doc = " "]
3881    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3882    #[rasn(automatic_tags)]
3883    #[non_exhaustive]
3884    pub struct IndividualRevocation {
3885        #[rasn(identifier = "linkageSeed1")]
3886        pub linkage_seed1: LinkageSeed,
3887        #[rasn(identifier = "linkageSeed2")]
3888        pub linkage_seed2: LinkageSeed,
3889    }
3890    impl IndividualRevocation {
3891        pub fn new(linkage_seed1: LinkageSeed, linkage_seed2: LinkageSeed) -> Self {
3892            Self {
3893                linkage_seed1,
3894                linkage_seed2,
3895            }
3896        }
3897    }
3898    #[doc = "*"]
3899    #[doc = " * @brief In this structure:"]
3900    #[doc = " *"]
3901    #[doc = " * @param\tjMax: is the value jMax used in the algorithm given in 5.1.3.4. This"]
3902    #[doc = " * value applies to all linkage-based revocation information included within"]
3903    #[doc = " * contents."]
3904    #[doc = " *"]
3905    #[doc = " * @param contents: contains individual linkage data."]
3906    #[doc = " "]
3907    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3908    #[rasn(automatic_tags)]
3909    #[non_exhaustive]
3910    pub struct JMaxGroup {
3911        pub jmax: Uint8,
3912        pub contents: SequenceOfLAGroup,
3913    }
3914    impl JMaxGroup {
3915        pub fn new(jmax: Uint8, contents: SequenceOfLAGroup) -> Self {
3916            Self { jmax, contents }
3917        }
3918    }
3919    #[doc = "*"]
3920    #[doc = " * @brief In this structure:"]
3921    #[doc = " *"]
3922    #[doc = " * @param la1Id: is the value LinkageAuthorityIdentifier1 used in the"]
3923    #[doc = " * algorithm given in 5.1.3.4. This value applies to all linkage-based"]
3924    #[doc = " * revocation information included within contents."]
3925    #[doc = " *"]
3926    #[doc = " * @param la2Id: is the value LinkageAuthorityIdentifier2 used in the"]
3927    #[doc = " * algorithm given in 5.1.3.4. This value applies to all linkage-based"]
3928    #[doc = " * revocation information included within contents."]
3929    #[doc = " *"]
3930    #[doc = " * @param contents: contains individual linkage data."]
3931    #[doc = " "]
3932    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3933    #[rasn(automatic_tags)]
3934    #[non_exhaustive]
3935    pub struct LAGroup {
3936        #[rasn(identifier = "la1Id")]
3937        pub la1_id: LaId,
3938        #[rasn(identifier = "la2Id")]
3939        pub la2_id: LaId,
3940        pub contents: SequenceOfIMaxGroup,
3941    }
3942    impl LAGroup {
3943        pub fn new(la1_id: LaId, la2_id: LaId, contents: SequenceOfIMaxGroup) -> Self {
3944            Self {
3945                la1_id,
3946                la2_id,
3947                contents,
3948            }
3949        }
3950    }
3951    #[doc = "*"]
3952    #[doc = " * @brief This is the identifier for the linkage value generation function. "]
3953    #[doc = " * See 5.1.3 for details of use."]
3954    #[doc = " "]
3955    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
3956    #[rasn(delegate)]
3957    pub struct LvGenerationFunctionIdentifier(pub ());
3958    #[doc = "*"]
3959    #[doc = " * @brief This is the identifier for the seed evolution function. See 5.1.3 "]
3960    #[doc = " * for details of use."]
3961    #[doc = " "]
3962    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash, Copy)]
3963    #[rasn(delegate)]
3964    pub struct SeedEvolutionFunctionIdentifier(pub ());
3965    #[doc = "*"]
3966    #[doc = " * @brief This type is used for clarity of definitions."]
3967    #[doc = " "]
3968    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3969    #[rasn(delegate)]
3970    pub struct SequenceOfGroupCrlEntry(pub SequenceOf<GroupCrlEntry>);
3971    #[doc = "*"]
3972    #[doc = " * @brief This type is used for clarity of definitions."]
3973    #[doc = " "]
3974    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3975    #[rasn(delegate)]
3976    pub struct SequenceOfGroupSingleSeedCrlEntry(pub SequenceOf<GroupSingleSeedCrlEntry>);
3977    #[doc = "*"]
3978    #[doc = " * @brief This type is used for clarity of definitions."]
3979    #[doc = " "]
3980    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3981    #[rasn(delegate)]
3982    pub struct SequenceOfHashBasedRevocationInfo(pub SequenceOf<HashBasedRevocationInfo>);
3983    #[doc = "*"]
3984    #[doc = " * @brief This type is used for clarity of definitions."]
3985    #[doc = " "]
3986    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3987    #[rasn(delegate)]
3988    pub struct SequenceOfIMaxGroup(pub SequenceOf<IMaxGroup>);
3989    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3990    #[rasn(delegate)]
3991    pub struct SequenceOfIPeriodInfo(pub SequenceOf<IPeriodInfo>);
3992    #[doc = "*"]
3993    #[doc = " * @brief This type is used for clarity of definitions."]
3994    #[doc = " "]
3995    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
3996    #[rasn(delegate)]
3997    pub struct SequenceOfIndividualRevocation(pub SequenceOf<IndividualRevocation>);
3998    #[doc = "*"]
3999    #[doc = " * @brief This type is used for clarity of definitions."]
4000    #[doc = " "]
4001    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4002    #[rasn(delegate)]
4003    pub struct SequenceOfJMaxGroup(pub SequenceOf<JMaxGroup>);
4004    #[doc = "*"]
4005    #[doc = " * @brief This type is used for clarity of definitions."]
4006    #[doc = " "]
4007    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4008    #[rasn(delegate)]
4009    pub struct SequenceOfLAGroup(pub SequenceOf<LAGroup>);
4010    #[doc = "*"]
4011    #[doc = " * @brief This data structure represents information about a revoked"]
4012    #[doc = " * certificate."]
4013    #[doc = " *"]
4014    #[doc = " * @param crlSerial: is a counter that increments by 1 every time a new full"]
4015    #[doc = " * or delta CRL is issued for the indicated crlCraca and crlSeries values.  A"]
4016    #[doc = " * \"new full or delta CRL\" is a CRL with a new issueDate, whether or not the"]
4017    #[doc = " * contents of the CRL have changed."]
4018    #[doc = " *"]
4019    #[doc = " * @param entries: contains the individual revocation information items."]
4020    #[doc = " *"]
4021    #[doc = " * @note To indicate that a hash-based CRL contains no individual revocation "]
4022    #[doc = " * information items, the recommended approach is for the SEQUENCE OF in the "]
4023    #[doc = " * SequenceOfHashBasedRevocationInfo in this field to indicate zero entries."]
4024    #[doc = " "]
4025    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4026    #[rasn(automatic_tags)]
4027    #[non_exhaustive]
4028    pub struct ToBeSignedHashIdCrl {
4029        #[rasn(identifier = "crlSerial")]
4030        pub crl_serial: Uint32,
4031        pub entries: SequenceOfHashBasedRevocationInfo,
4032    }
4033    impl ToBeSignedHashIdCrl {
4034        pub fn new(crl_serial: Uint32, entries: SequenceOfHashBasedRevocationInfo) -> Self {
4035            Self {
4036                crl_serial,
4037                entries,
4038            }
4039        }
4040    }
4041    #[doc = "*"]
4042    #[doc = " * @brief In this structure:"]
4043    #[doc = " *"]
4044    #[doc = " * @param\tiRev: is the value iRev used in the algorithm given in 5.1.3.4. This"]
4045    #[doc = " * value applies to all linkage-based revocation information included within"]
4046    #[doc = " * either indvidual or groups."]
4047    #[doc = " *"]
4048    #[doc = " * @param\tindexWithinI: is a counter that is set to 0 for the first CRL issued"]
4049    #[doc = " * for the indicated combination of crlCraca, crlSeries, and iRev, and"]
4050    #[doc = " * increments by 1 every time a new full or delta CRL is issued for the"]
4051    #[doc = " * indicated crlCraca and crlSeries values without changing iRev."]
4052    #[doc = " *"]
4053    #[doc = " * @param individual: contains individual linkage data."]
4054    #[doc = " *"]
4055    #[doc = " * @note To indicate that a linkage ID-based CRL contains no individual"]
4056    #[doc = " * linkage data, the recommended approach is for the SEQUENCE OF in the"]
4057    #[doc = " * SequenceOfJMaxGroup in this field to indicate zero entries."]
4058    #[doc = " *"]
4059    #[doc = " * @param groups: contains group linkage data."]
4060    #[doc = " *"]
4061    #[doc = " * @note To indicate that a linkage ID-based CRL contains no group linkage"]
4062    #[doc = " * data, the recommended approach is for the SEQUENCE OF in the"]
4063    #[doc = " * SequenceOfGroupCrlEntry in this field to indicate zero entries."]
4064    #[doc = " *"]
4065    #[doc = " * @param groupsSingleSeed: contains group linkage data generated with a single "]
4066    #[doc = " * seed."]
4067    #[doc = " *"]
4068    #[doc = " * @param iPeriodInfo contains information about the duration of the revocation"]
4069    #[doc = " * time periods, to allow a receiver to determine at what point it will be"]
4070    #[doc = " * necessary to have calculated the linkage values associated with future time"]
4071    #[doc = " * periods."]
4072    #[doc = " "]
4073    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4074    #[rasn(automatic_tags)]
4075    #[non_exhaustive]
4076    pub struct ToBeSignedLinkageValueCrl {
4077        #[rasn(identifier = "iRev")]
4078        pub i_rev: IValue,
4079        #[rasn(identifier = "indexWithinI")]
4080        pub index_within_i: Uint8,
4081        pub individual: Option<SequenceOfJMaxGroup>,
4082        pub groups: Option<SequenceOfGroupCrlEntry>,
4083        #[rasn(extension_addition, identifier = "groupsSingleSeed")]
4084        pub groups_single_seed: Option<SequenceOfGroupSingleSeedCrlEntry>,
4085        #[rasn(extension_addition, identifier = "iPeriodInfo")]
4086        pub i_period_info: Option<SequenceOfIPeriodInfo>,
4087    }
4088    impl ToBeSignedLinkageValueCrl {
4089        pub fn new(
4090            i_rev: IValue,
4091            index_within_i: Uint8,
4092            individual: Option<SequenceOfJMaxGroup>,
4093            groups: Option<SequenceOfGroupCrlEntry>,
4094            groups_single_seed: Option<SequenceOfGroupSingleSeedCrlEntry>,
4095            i_period_info: Option<SequenceOfIPeriodInfo>,
4096        ) -> Self {
4097            Self {
4098                i_rev,
4099                index_within_i,
4100                individual,
4101                groups,
4102                groups_single_seed,
4103                i_period_info,
4104            }
4105        }
4106    }
4107    #[doc = "*"]
4108    #[doc = " * @brief In this structure:"]
4109    #[doc = " * "]
4110    #[doc = " * @param iRev is the value iRev used in the algorithm given in 5.1.3.4. This "]
4111    #[doc = " * value applies to all linkage-based revocation information included within "]
4112    #[doc = " * either indvidual or groups."]
4113    #[doc = " * "]
4114    #[doc = " * @param indexWithinI is a counter that is set to 0 for the first CRL issued "]
4115    #[doc = " * for the indicated combination of crlCraca, crlSeries, and iRev, and increments"]
4116    #[doc = " * by 1 every time a new full or delta CRL is issued for the indicated crlCraca "]
4117    #[doc = " * and crlSeries values without changing iRev."]
4118    #[doc = " * "]
4119    #[doc = " * @param seedEvolution contains an identifier for the seed evolution "]
4120    #[doc = " * function, used as specified in  5.1.3.4."]
4121    #[doc = " * "]
4122    #[doc = " * @param lvGeneration contains an identifier for the linkage value "]
4123    #[doc = " * generation function, used as specified in  5.1.3.4."]
4124    #[doc = " * "]
4125    #[doc = " * @param individual contains individual linkage data."]
4126    #[doc = " * "]
4127    #[doc = " * @param groups contains group linkage data for linkage value generation "]
4128    #[doc = " * with two seeds."]
4129    #[doc = " * "]
4130    #[doc = " * @param groupsSingleSeed contains group linkage data for linkage value "]
4131    #[doc = " * generation with one seed."]
4132    #[doc = " *"]
4133    #[doc = " * @param iPeriodInfo contains information about the duration of the "]
4134    #[doc = " * revocation time periods, to allow a receiver to determine at what point"]
4135    #[doc = " * it will be necessary to have calculated the linkage values associated"]
4136    #[doc = " * with future time periods."]
4137    #[doc = " "]
4138    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4139    #[rasn(automatic_tags)]
4140    #[non_exhaustive]
4141    pub struct ToBeSignedLinkageValueCrlWithAlgIdentifier {
4142        #[rasn(identifier = "iRev")]
4143        pub i_rev: IValue,
4144        #[rasn(identifier = "indexWithinI")]
4145        pub index_within_i: Uint8,
4146        #[rasn(identifier = "seedEvolution")]
4147        pub seed_evolution: SeedEvolutionFunctionIdentifier,
4148        #[rasn(identifier = "lvGeneration")]
4149        pub lv_generation: LvGenerationFunctionIdentifier,
4150        pub individual: Option<SequenceOfJMaxGroup>,
4151        pub groups: Option<SequenceOfGroupCrlEntry>,
4152        #[rasn(identifier = "groupsSingleSeed")]
4153        pub groups_single_seed: Option<SequenceOfGroupSingleSeedCrlEntry>,
4154    }
4155    impl ToBeSignedLinkageValueCrlWithAlgIdentifier {
4156        pub fn new(
4157            i_rev: IValue,
4158            index_within_i: Uint8,
4159            seed_evolution: SeedEvolutionFunctionIdentifier,
4160            lv_generation: LvGenerationFunctionIdentifier,
4161            individual: Option<SequenceOfJMaxGroup>,
4162            groups: Option<SequenceOfGroupCrlEntry>,
4163            groups_single_seed: Option<SequenceOfGroupSingleSeedCrlEntry>,
4164        ) -> Self {
4165            Self {
4166                i_rev,
4167                index_within_i,
4168                seed_evolution,
4169                lv_generation,
4170                individual,
4171                groups,
4172                groups_single_seed,
4173            }
4174        }
4175    }
4176    #[doc = "*"]
4177    #[doc = " * @brief This structure contains type-specific CRL contents."]
4178    #[doc = " *"]
4179    #[doc = " * @param fullHashCrl: contains a full hash-based CRL, i.e., a listing of the"]
4180    #[doc = " * hashes of all certificates that:"]
4181    #[doc = " *  - contain the indicated cracaId and crlSeries values, and"]
4182    #[doc = " *  - are revoked by hash, and"]
4183    #[doc = " *  - have been revoked"]
4184    #[doc = " *"]
4185    #[doc = " * @param deltaHashCrl: contains a delta hash-based CRL, i.e., a listing of"]
4186    #[doc = " * the hashes of all certificates that:"]
4187    #[doc = " *  - contain the indicated cracaId and crlSeries values, and"]
4188    #[doc = " *  - are revoked by hash, and"]
4189    #[doc = " *  - have been revoked since the previous CRL that contained the indicated"]
4190    #[doc = " * cracaId and crlSeries values."]
4191    #[doc = " *"]
4192    #[doc = " * A Hash-based CRL should not include any certificates that had expired at the"]
4193    #[doc = " * time the CRL was generated; however, the inclusion of expired certificates"]
4194    #[doc = " * does not make a CRL invalid, and there is no expectation that receivers of a"]
4195    #[doc = " * CRL will check whether any of the certificates on the CRL have expired. "]
4196    #[doc = " *"]
4197    #[doc = " * @note Since a recipient of a hash-based CRLonly receives the hash, they"]
4198    #[doc = " * cannot directly establish the validity period of any certificate on the CRL"]
4199    #[doc = " * without obtaining the certificate itself; this would render impractical any"]
4200    #[doc = " * validity check for CRLs based on the expiry status of the revoked"]
4201    #[doc = " * certificates."]
4202    #[doc = " *"]
4203    #[doc = " * @param fullLinkedCrl and fullLinkedCrlWithAlg: contain a full linkage"]
4204    #[doc = " * ID-based CRL, i.e., a listing of the individual and/or group linkage data"]
4205    #[doc = " * for all certificates that:"]
4206    #[doc = " *  - contain the indicated cracaId and crlSeries values, and"]
4207    #[doc = " *  - are revoked by linkage value, and"]
4208    #[doc = " *  - have been revoked"]
4209    #[doc = " * The difference between fullLinkedCrl and fullLinkedCrlWithAlg is in how"]
4210    #[doc = " * the cryptographic algorithms to be used in the seed evolution function and"]
4211    #[doc = " * linkage value generation function of 5.1.3.4 are communicated to the"]
4212    #[doc = " * receiver of the CRL. See below in this subclause for details."]
4213    #[doc = " *"]
4214    #[doc = " * @param deltaLinkedCrl and deltaLinkedCrlWithAlg: contain a delta linkage"]
4215    #[doc = " * ID-based CRL, i.e., a listing of the individual and/or group linkage data"]
4216    #[doc = " * for all certificates that:"]
4217    #[doc = " *  - contain the specified cracaId and crlSeries values, and"]
4218    #[doc = " *  -\tare revoked by linkage data, and"]
4219    #[doc = " *  -\thave been revoked since the previous CRL that contained the indicated"]
4220    #[doc = " * cracaId and crlSeries values."]
4221    #[doc = " * The difference between deltaLinkedCrl and deltaLinkedCrlWithAlg is in how"]
4222    #[doc = " * the cryptographic algorithms to be used in the seed evolution function"]
4223    #[doc = " * and linkage value generation function of 5.1.3.4 are communicated to the"]
4224    #[doc = " * receiver of the CRL. See below in this subclause for details."]
4225    #[doc = " *"]
4226    #[doc = " * @note It is the intent of this standard that once a certificate is revoked,"]
4227    #[doc = " * it remains revoked for the rest of its lifetime. CRL signers are expected "]
4228    #[doc = " * to include a revoked certificate on all CRLs issued between the "]
4229    #[doc = " * certificate's revocation and its expiry."]
4230    #[doc = " *"]
4231    #[doc = " * @note Seed evolution function and linkage value generation function"]
4232    #[doc = " * identification. In order to derive linkage values per the mechanisms given"]
4233    #[doc = " * in 5.1.3.4, a receiver needs to know the seed evolution function and the"]
4234    #[doc = " * linkage value generation function."]
4235    #[doc = " *"]
4236    #[doc = " * If the contents of this structure is a"]
4237    #[doc = " * ToBeSignedLinkageValueCrlWithAlgIdentifier, then the seed evolution function"]
4238    #[doc = " * and linkage value generation function are given explicitly as specified in"]
4239    #[doc = " * the specification of ToBeSignedLinkageValueCrlWithAlgIdentifier."]
4240    #[doc = " *"]
4241    #[doc = " * If the contents of this structure is a ToBeSignedLinkageValueCrl, then the"]
4242    #[doc = " * seed evolution function and linkage value generation function are obtained"]
4243    #[doc = " * based on the crlCraca field in the CrlContents:"]
4244    #[doc = " *  - If crlCraca was obtained with SHA-256 or SHA-384, then"]
4245    #[doc = " * seedEvolutionFunctionIdentifier is seedEvoFn1-sha256 and"]
4246    #[doc = " * linkageValueGenerationFunctionIdentifier is lvGenFn1-aes128."]
4247    #[doc = " *  - If crlCraca was obtained with SM3, then seedEvolutionFunctionIdentifier"]
4248    #[doc = " * is seedEvoFn1-sm3 and linkageValueGenerationFunctionIdentifier is"]
4249    #[doc = " * lvGenFn1-sm4."]
4250    #[doc = " "]
4251    #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
4252    #[rasn(choice, automatic_tags)]
4253    #[non_exhaustive]
4254    pub enum TypeSpecificCrlContents {
4255        fullHashCrl(ToBeSignedHashIdCrl),
4256        deltaHashCrl(ToBeSignedHashIdCrl),
4257        fullLinkedCrl(ToBeSignedLinkageValueCrl),
4258        deltaLinkedCrl(ToBeSignedLinkageValueCrl),
4259        #[rasn(extension_addition)]
4260        fullLinkedCrlWithAlg(ToBeSignedLinkageValueCrlWithAlgIdentifier),
4261        #[rasn(extension_addition)]
4262        deltaLinkedCrlWithAlg(ToBeSignedLinkageValueCrlWithAlgIdentifier),
4263    }
4264}