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§
Sourcefn parse(
format: &str,
algorithm_hint: Option<&str>,
bytes: &[u8],
opts: Option<OptionView<'_>>,
) -> PluginResult<Self>
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).
Sourcefn serialize(&self, format: &str) -> PluginResult<Vec<u8>>
fn serialize(&self, format: &str) -> PluginResult<Vec<u8>>
Serialize the key into the named format. Returns the bytes.
Sourcefn kind(&self) -> PluginResult<KeyKind>
fn kind(&self) -> PluginResult<KeyKind>
Report whether this key is secret, public, or both.
Sourcefn algorithm(&self) -> PluginResult<String>
fn algorithm(&self) -> PluginResult<String>
Report the algorithm name for this key.
Sourcefn public(&self) -> PluginResult<Self>
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".