pub trait ToExtension {
type Error;
// Required method
fn to_extension(
self,
subject: &Name,
extensions: &[Extension],
) -> Result<Extension, Self::Error>;
}Expand description
Trait to be implemented by extensions to allow them to be formatted as x509 v3 extensions by builder.
§Examples
use const_oid::{AssociatedOid, ObjectIdentifier};
use x509_cert::{der::Sequence, ext, name};
/// This extension indicates the age of the captain at the time of signature
#[derive(Clone, Debug, Eq, PartialEq, Sequence)]
pub struct CaptainAge {
pub age: u32,
}
impl AssociatedOid for CaptainAge {
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.3.6.1.4.1.32473.1");
}
impl ext::Criticality for CaptainAge {
fn criticality(&self, _subject: &name::Name, _extensions: &[ext::Extension]) -> bool {
false
}
}Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".