• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::name::GeneralNames;
2 
3 use const_oid::db::rfc5280::ID_CE_AUTHORITY_KEY_IDENTIFIER;
4 use const_oid::{AssociatedOid, ObjectIdentifier};
5 use der::asn1::{OctetStringRef, UIntRef};
6 use der::Sequence;
7 
8 /// AuthorityKeyIdentifier as defined in [RFC 5280 Section 4.2.1.1].
9 ///
10 /// ```text
11 /// AuthorityKeyIdentifier ::= SEQUENCE {
12 ///     keyIdentifier             [0] KeyIdentifier           OPTIONAL,
13 ///     authorityCertIssuer       [1] GeneralNames            OPTIONAL,
14 ///     authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL
15 /// }
16 ///
17 /// KeyIdentifier ::= OCTET STRING
18 /// ```
19 ///
20 /// [RFC 5280 Section 4.2.1.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.1
21 #[derive(Clone, Debug, Eq, PartialEq, Sequence)]
22 #[allow(missing_docs)]
23 pub struct AuthorityKeyIdentifier<'a> {
24     #[asn1(context_specific = "0", tag_mode = "IMPLICIT", optional = "true")]
25     pub key_identifier: Option<OctetStringRef<'a>>,
26 
27     #[asn1(context_specific = "1", tag_mode = "IMPLICIT", optional = "true")]
28     pub authority_cert_issuer: Option<GeneralNames<'a>>,
29 
30     #[asn1(context_specific = "2", tag_mode = "IMPLICIT", optional = "true")]
31     pub authority_cert_serial_number: Option<UIntRef<'a>>,
32 }
33 
34 impl<'a> AssociatedOid for AuthorityKeyIdentifier<'a> {
35     const OID: ObjectIdentifier = ID_CE_AUTHORITY_KEY_IDENTIFIER;
36 }
37