1use core::cmp::Ordering;
3
4use der::asn1::SetOfVec;
5use der::{Any, Choice, Sequence, ValueOrd};
6use spki::AlgorithmIdentifierOwned;
7
8use x509_cert::crl::CertificateList;
9use x509_cert::impl_newtype;
10
11#[derive(Clone, Eq, PartialEq, Debug)]
19pub struct RevocationInfoChoices(pub SetOfVec<RevocationInfoChoice>);
20impl_newtype!(RevocationInfoChoices, SetOfVec<RevocationInfoChoice>);
21
22#[derive(Clone, Debug, Eq, PartialEq, Choice)]
33#[allow(missing_docs)]
34#[allow(clippy::large_enum_variant)]
35pub enum RevocationInfoChoice {
36 Crl(CertificateList),
37 #[asn1(context_specific = "1", tag_mode = "IMPLICIT", constructed = "true")]
38 Other(OtherRevocationInfoFormat),
39}
40
41impl ValueOrd for RevocationInfoChoice {
43 fn value_cmp(&self, other: &Self) -> der::Result<Ordering> {
44 use der::DerOrd;
45 use der::Encode;
46 self.to_der()?.der_cmp(&other.to_der()?)
47 }
48}
49
50#[cfg(feature = "std")]
51impl TryFrom<std::vec::Vec<RevocationInfoChoice>> for RevocationInfoChoices {
52 type Error = der::Error;
53
54 fn try_from(vec: std::vec::Vec<RevocationInfoChoice>) -> der::Result<RevocationInfoChoices> {
55 Ok(RevocationInfoChoices(SetOfVec::try_from(vec)?))
56 }
57}
58
59#[derive(Clone, Debug, Eq, PartialEq, Sequence)]
71#[allow(missing_docs)]
72pub struct OtherRevocationInfoFormat {
73 pub other_format: AlgorithmIdentifierOwned,
74 pub other: Any,
75}