diff --git a/x509-cert/src/anchor.rs b/x509-cert/src/anchor.rs index bc3a2fb6f..bc00ad447 100644 --- a/x509-cert/src/anchor.rs +++ b/x509-cert/src/anchor.rs @@ -1,8 +1,8 @@ //! Trust anchor-related structures as defined in RFC 5914 +use crate::certificate::{CertificateInner, Profile, Rfc5280, TbsCertificateInner}; use crate::ext::pkix::{certpolicy::CertificatePolicies, NameConstraints}; use crate::{ext::Extensions, name::Name}; -use crate::{Certificate, TbsCertificate}; use alloc::string::String; use der::asn1::OctetString; @@ -37,7 +37,7 @@ pub enum Version { /// ``` #[derive(Clone, Debug, PartialEq, Eq, Sequence)] #[allow(missing_docs)] -pub struct TrustAnchorInfo { +pub struct TrustAnchorInfo { #[asn1(default = "Default::default")] pub version: Version, @@ -49,7 +49,7 @@ pub struct TrustAnchorInfo { pub ta_title: Option, #[asn1(optional = "true")] - pub cert_path: Option, + pub cert_path: Option>, #[asn1(context_specific = "1", tag_mode = "EXPLICIT", optional = "true")] pub extensions: Option, @@ -70,11 +70,11 @@ pub struct TrustAnchorInfo { /// ``` #[derive(Clone, Debug, Eq, PartialEq, Sequence)] #[allow(missing_docs)] -pub struct CertPathControls { +pub struct CertPathControls { pub ta_name: Name, #[asn1(context_specific = "0", tag_mode = "IMPLICIT", optional = "true")] - pub certificate: Option, + pub certificate: Option>, #[asn1(context_specific = "1", tag_mode = "IMPLICIT", optional = "true")] pub policy_set: Option, @@ -114,6 +114,9 @@ flags! { /// [RFC 5280 Section 4.2.1.13]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.13 pub type CertPolicyFlags = FlagSet; +/// TrustAnchorInfo allows for the representation of a single trust anchor. +/// Defined in [RFC 5914 Section 3]. +/// /// ```text /// TrustAnchorChoice ::= CHOICE { /// certificate Certificate, @@ -121,15 +124,17 @@ pub type CertPolicyFlags = FlagSet; /// taInfo [2] EXPLICIT TrustAnchorInfo /// } /// ``` +/// +/// [RFC 5914 Section 3]: https://www.rfc-editor.org/rfc/rfc5914#section-3 #[derive(Clone, Debug, PartialEq, Eq, Choice)] #[allow(clippy::large_enum_variant)] #[allow(missing_docs)] -pub enum TrustAnchorChoice { - Certificate(Certificate), +pub enum TrustAnchorChoice { + Certificate(CertificateInner

), #[asn1(context_specific = "1", tag_mode = "EXPLICIT", constructed = "true")] - TbsCertificate(TbsCertificate), + TbsCertificate(TbsCertificateInner

), #[asn1(context_specific = "2", tag_mode = "EXPLICIT", constructed = "true")] - TaInfo(TrustAnchorInfo), + TaInfo(TrustAnchorInfo

), } diff --git a/x509-cert/src/crl.rs b/x509-cert/src/crl.rs index 6916783bd..1d3994f10 100644 --- a/x509-cert/src/crl.rs +++ b/x509-cert/src/crl.rs @@ -1,5 +1,6 @@ //! Certificate Revocation List types +use crate::certificate::{Profile, Rfc5280}; use crate::ext::Extensions; use crate::name::Name; use crate::serial_number::SerialNumber; @@ -25,8 +26,8 @@ use spki::AlgorithmIdentifierOwned; /// [RFC 5280 Section 5.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-5.1 #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] #[allow(missing_docs)] -pub struct CertificateList { - pub tbs_cert_list: TbsCertList, +pub struct CertificateList { + pub tbs_cert_list: TbsCertList

, pub signature_algorithm: AlgorithmIdentifierOwned, pub signature: BitString, } @@ -47,8 +48,8 @@ pub struct CertificateList { /// [RFC 5280 Section 5.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-5.1 #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] #[allow(missing_docs)] -pub struct RevokedCert { - pub serial_number: SerialNumber, +pub struct RevokedCert { + pub serial_number: SerialNumber

, pub revocation_date: Time, pub crl_entry_extensions: Option, } @@ -74,13 +75,13 @@ pub struct RevokedCert { /// [RFC 5280 Section 5.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-5.1 #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)] #[allow(missing_docs)] -pub struct TbsCertList { +pub struct TbsCertList { pub version: Version, pub signature: AlgorithmIdentifierOwned, pub issuer: Name, pub this_update: Time, pub next_update: Option