x509_cert/ext/pkix/name/
ediparty.rs

1use der::{Sequence, ValueOrd};
2
3use super::DirectoryString;
4
5/// EDIPartyName as defined in [RFC 5280 Section 4.2.1.6].
6///
7/// ```text
8/// EDIPartyName ::= SEQUENCE {
9///     nameAssigner            [0] DirectoryString OPTIONAL,
10///     partyName               [1] DirectoryString
11/// }
12/// ```
13///
14/// Note that although the module uses `IMPLICIT` tagging, these tags are
15/// `EXPLICIT` because of `X.680-2015 31.2.7 (c)`:
16///
17/// ```text
18/// c) the "Tag Type" alternative is used and the value of "TagDefault" for
19/// the module is IMPLICIT TAGS or AUTOMATIC TAGS, but the type defined by
20/// "Type" is an untagged choice type, an untagged open type, or an untagged
21/// "DummyReference" (see Rec. ITU-T X.683 | ISO/IEC 8824-4, 8.3).
22/// ```
23///
24/// See [this OpenSSL bug] for more details.
25///
26/// [this OpenSSL bug]: https://github.com/openssl/openssl/issues/6859
27/// [RFC 5280 Section 4.2.1.6]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6
28#[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)]
29#[allow(missing_docs)]
30pub struct EdiPartyName {
31    #[asn1(context_specific = "0", tag_mode = "EXPLICIT", optional = "true")]
32    pub name_assigner: Option<DirectoryString>,
33
34    #[asn1(context_specific = "1", tag_mode = "EXPLICIT")]
35    pub party_name: DirectoryString,
36}