Skip to content

Commit 36449d1

Browse files
committed
feat(x509): add PkiPath type
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
1 parent 346388d commit 36449d1

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

x509/src/certificate.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use crate::{name::Name, time::Validity};
22

3+
use alloc::vec::Vec;
4+
35
use der::asn1::{BitString, UIntBytes};
4-
use der::{Enumerated, Sequence};
6+
use der::{Enumerated, Newtype, Sequence};
57
use spki::{AlgorithmIdentifier, SubjectPublicKeyInfo};
68

79
/// Certificate `Version` as defined in [RFC 5280 Section 4.1].
@@ -103,3 +105,17 @@ pub struct Certificate<'a> {
103105
pub signature_algorithm: AlgorithmIdentifier<'a>,
104106
pub signature: BitString<'a>,
105107
}
108+
109+
/// `PkiPath` as defined by X.509 and referenced by [RFC 6066].
110+
///
111+
/// This contains a series of certificates in validation order from the
112+
/// top-most certificate to the bottom-most certificate. This means that
113+
/// the first certificate signs the second certificate and so on.
114+
///
115+
/// ```text
116+
/// PkiPath ::= SEQUENCE OF Certificate
117+
/// ```
118+
///
119+
/// [RFC 6066]: https://datatracker.ietf.org/doc/html/rfc6066#section-10.1
120+
#[derive(Clone, Debug, PartialEq, Eq, Default, Newtype)]
121+
pub struct PkiPath<'a>(Vec<Certificate<'a>>);

x509/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ pub mod time;
2323

2424
mod certificate;
2525

26-
pub use certificate::{Certificate, TbsCertificate, Version};
26+
pub use certificate::{Certificate, PkiPath, TbsCertificate, Version};

0 commit comments

Comments
 (0)