Trait EncodableKey

Source
pub trait EncodableKey: Sized {
    // Required methods
    fn read<R>(reader: &mut R) -> Result<Self, Box<dyn Error>>
       where R: Read;
    fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
       where W: Write;

    // Provided methods
    fn read_from_file<F>(path: F) -> Result<Self, Box<dyn Error>>
       where F: AsRef<Path> { ... }
    fn write_to_file<F>(&self, outfile: F) -> Result<String, Box<dyn Error>>
       where F: AsRef<Path> { ... }
}
Expand description

The EncodableKey trait defines the interface by which cryptographic keys/keypairs are read, written, and derived from sources.

Required Methods§

Source

fn read<R>(reader: &mut R) -> Result<Self, Box<dyn Error>>
where R: Read,

Source

fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
where W: Write,

Provided Methods§

Source

fn read_from_file<F>(path: F) -> Result<Self, Box<dyn Error>>
where F: AsRef<Path>,

Source

fn write_to_file<F>(&self, outfile: F) -> Result<String, Box<dyn Error>>
where F: AsRef<Path>,

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.

Implementations on Foreign Types§

Source§

impl EncodableKey for AeKey

Source§

fn read<R>(reader: &mut R) -> Result<AeKey, Box<dyn Error>>
where R: Read,

Source§

fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
where W: Write,

Source§

impl EncodableKey for ElGamalKeypair

Source§

fn read<R>(reader: &mut R) -> Result<ElGamalKeypair, Box<dyn Error>>
where R: Read,

Source§

fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
where W: Write,

Source§

impl EncodableKey for ElGamalPubkey

Source§

fn read<R>(reader: &mut R) -> Result<ElGamalPubkey, Box<dyn Error>>
where R: Read,

Source§

fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
where W: Write,

Source§

impl EncodableKey for ElGamalSecretKey

Source§

fn read<R>(reader: &mut R) -> Result<ElGamalSecretKey, Box<dyn Error>>
where R: Read,

Source§

fn write<W>(&self, writer: &mut W) -> Result<String, Box<dyn Error>>
where W: Write,

Implementors§