|
| 1 | +use super::name::GeneralNames; |
| 2 | +use crate::Typed; |
| 3 | + |
| 4 | +use der::asn1::{ObjectIdentifier, UIntBytes}; |
| 5 | +use der::Sequence; |
| 6 | + |
| 7 | +/// Authority key identifier extension as defined in [RFC 5280 Section 4.2.1.1]. |
| 8 | +/// |
| 9 | +/// ```text |
| 10 | +/// AuthorityKeyIdentifier ::= SEQUENCE { |
| 11 | +/// keyIdentifier [0] KeyIdentifier OPTIONAL, |
| 12 | +/// authorityCertIssuer [1] GeneralNames OPTIONAL, |
| 13 | +/// authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL |
| 14 | +/// } |
| 15 | +/// |
| 16 | +/// KeyIdentifier ::= OCTET STRING |
| 17 | +/// ``` |
| 18 | +/// |
| 19 | +/// [RFC 5280 Section 4.2.1.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.1 |
| 20 | +#[derive(Clone, Debug, Eq, PartialEq, Sequence)] |
| 21 | +pub struct AuthorityKeyIdentifier<'a> { |
| 22 | + /// keyIdentifier |
| 23 | + #[asn1( |
| 24 | + context_specific = "0", |
| 25 | + optional = "true", |
| 26 | + tag_mode = "IMPLICIT", |
| 27 | + type = "OCTET STRING" |
| 28 | + )] |
| 29 | + pub key_identifier: Option<&'a [u8]>, |
| 30 | + |
| 31 | + /// authorityCertIssuer |
| 32 | + #[asn1(context_specific = "1", optional = "true", tag_mode = "IMPLICIT")] |
| 33 | + pub authority_cert_issuer: Option<GeneralNames<'a>>, |
| 34 | + |
| 35 | + /// authorityCertSerialNumber |
| 36 | + #[asn1(context_specific = "2", optional = "true", tag_mode = "IMPLICIT")] |
| 37 | + pub authority_cert_serial_number: Option<UIntBytes<'a>>, |
| 38 | +} |
| 39 | + |
| 40 | +impl Typed for AuthorityKeyIdentifier<'_> { |
| 41 | + const OID: ObjectIdentifier = ObjectIdentifier::new("2.5.29.35"); |
| 42 | +} |
0 commit comments