• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use alloc::vec::Vec;
2 
3 use const_oid::db::rfc5280::ID_CE_POLICY_MAPPINGS;
4 use const_oid::AssociatedOid;
5 use der::asn1::ObjectIdentifier;
6 use der::{Sequence, ValueOrd};
7 
8 /// PolicyMappings as defined in [RFC 5280 Section 4.2.1.5].
9 ///
10 /// ```text
11 /// PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
12 /// ```
13 ///
14 /// [RFC 5280 Section 4.2.1.5]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.5
15 #[derive(Clone, Debug, PartialEq, Eq)]
16 pub struct PolicyMappings(pub Vec<PolicyMapping>);
17 
18 impl AssociatedOid for PolicyMappings {
19     const OID: ObjectIdentifier = ID_CE_POLICY_MAPPINGS;
20 }
21 
22 impl_newtype!(PolicyMappings, Vec<PolicyMapping>);
23 
24 /// PolicyMapping as defined in [RFC 5280 Section 4.2.1.5].
25 ///
26 /// ```text
27 /// PolicyMapping ::= SEQUENCE {
28 ///     issuerDomainPolicy      CertPolicyId,
29 ///     subjectDomainPolicy     CertPolicyId
30 /// }
31 /// ```
32 ///
33 /// [RFC 5280 Section 4.2.1.5]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.5
34 #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)]
35 #[allow(missing_docs)]
36 pub struct PolicyMapping {
37     pub issuer_domain_policy: ObjectIdentifier,
38     pub subject_domain_policy: ObjectIdentifier,
39 }
40