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 impl_extension!(PolicyMappings, critical = true);
24 
25 /// PolicyMapping as defined in [RFC 5280 Section 4.2.1.5].
26 ///
27 /// ```text
28 /// PolicyMapping ::= SEQUENCE {
29 ///     issuerDomainPolicy      CertPolicyId,
30 ///     subjectDomainPolicy     CertPolicyId
31 /// }
32 /// ```
33 ///
34 /// [RFC 5280 Section 4.2.1.5]: https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.5
35 #[derive(Clone, Debug, Eq, PartialEq, Sequence, ValueOrd)]
36 #[allow(missing_docs)]
37 pub struct PolicyMapping {
38     pub issuer_domain_policy: ObjectIdentifier,
39     pub subject_domain_policy: ObjectIdentifier,
40 }
41