tor_key_forge

Trait ToEncodableCert

Source
pub trait ToEncodableCert<K: ToEncodableKey>: Clone {
    type Cert: EncodableItem + 'static;
    type SigningKey: ToEncodableKey;

    // Required methods
    fn validate(
        &self,
        subject: &K,
        signed_with: &Self::SigningKey,
    ) -> StdResult<(), InvalidCertError>;
    fn to_encodable_cert(self) -> Self::Cert;
    fn from_encodable_cert(cert: Self::Cert) -> Self
       where Self: Sized;
}
Expand description

A trait representing an encodable certificate.

K represents the (Rust) type of the subject key.

Required Associated Types§

Source

type Cert: EncodableItem + 'static

The low-level type this can be converted to/from.

Source

type SigningKey: ToEncodableKey

The (Rust) type of the signing key.

Required Methods§

Source

fn validate( &self, subject: &K, signed_with: &Self::SigningKey, ) -> StdResult<(), InvalidCertError>

Validate this certificate. This function should return an error if

  • the certificate is not timely (i.e. it is expired, or not yet valid), or
  • the certificate is not well-signed, or
  • the subject key or signing key in the certificate do not match the subject and signing keys specified in cert_spec
Source

fn to_encodable_cert(self) -> Self::Cert

Convert this cert to a type that implements EncodableItem.

Source

fn from_encodable_cert(cert: Self::Cert) -> Self
where Self: Sized,

Convert an EncodableItem to another cert type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§