x509_client/api.rs
1use std::fmt::{Debug, Display};
2
3/// X509 Deserializer API
4pub trait X509Iterator: IntoIterator + FromIterator<Self::Item>
5where
6 Self: Sized,
7{
8 /// Error type
9 type X509IteratorError: X509IteratorError;
10
11 /// Attempt to deserialize, assume input is a single DER-encoded certificate
12 fn from_cer<T: AsRef<[u8]>>(src: T) -> Result<Self, Self::X509IteratorError>;
13 /// Attempt to deserialize, assume input is a stack of zero or more PEM-encoded certificates
14 fn from_pem<T: AsRef<[u8]>>(src: T) -> Result<Self, Self::X509IteratorError>;
15 /// Attempt to deserialize, assume input is a DER-encoded PKCS7 certificate bundle
16 fn from_pkcs7<T: AsRef<[u8]>>(src: T) -> Result<Self, Self::X509IteratorError>;
17}
18
19/// Error type bounds
20pub trait X509IteratorError: Display + Debug {}