Skip to main content

KeyfmtPlugin

Trait KeyfmtPlugin 

Source
pub trait KeyfmtPlugin: Sized {
    // Required methods
    fn parse(
        format: &str,
        algorithm_hint: Option<&str>,
        bytes: &[u8],
        opts: Option<OptionView<'_>>,
    ) -> PluginResult<Self>;
    fn serialize(&self, format: &str) -> PluginResult<Vec<u8>>;
    fn kind(&self) -> PluginResult<KeyKind>;
    fn algorithm(&self) -> PluginResult<String>;
    fn public(&self) -> PluginResult<Self>;
}
Expand description

Trait implemented by key-format plugins. The type Self is the parsed key representation; parse constructs it from bytes and serialize writes it back out.

Required Methods§

Source

fn parse( format: &str, algorithm_hint: Option<&str>, bytes: &[u8], opts: Option<OptionView<'_>>, ) -> PluginResult<Self>

Parse bytes in the named format into a key object. The algorithm_hint may guide format-specific parsing (e.g. for Raw format).

Source

fn serialize(&self, format: &str) -> PluginResult<Vec<u8>>

Serialize the key into the named format. Returns the bytes.

Source

fn kind(&self) -> PluginResult<KeyKind>

Report whether this key is secret, public, or both.

Source

fn algorithm(&self) -> PluginResult<String>

Report the algorithm name for this key.

Source

fn public(&self) -> PluginResult<Self>

Produce a public-only view of this key (stripping secret material). The returned value is a new boxed key object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§