Trait ValidCryptoMaterial

Source
pub trait ValidCryptoMaterial:
    for<'a> TryFrom<&'a [u8], Error = CryptoMaterialError>
    + Serialize
    + DeserializeOwned {
    // Required method
    fn to_bytes(&self) -> Vec<u8> ;
}
Expand description

Key or more generally crypto material with a notion of byte validation.

A type family for material that knows how to serialize and deserialize, as well as validate byte-encoded material. The validation must be implemented as a TryFrom which classifies its failures against the above CryptoMaterialError.

This provides an implementation for a validation that relies on a round-trip to bytes and corresponding TryFrom.

Required Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Convert the valid crypto material to bytes.

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§