pub trait VerifyingKey<T>: Sized
where T: Algorithm<VerifyingKey = Self>,
{ // Required methods fn from_slice(raw: &[u8]) -> Result<Self>; fn as_bytes(&self) -> Cow<'_, [u8]>; }
Expand description

Verifying key for a specific signature cryptosystem. In the case of public-key cryptosystems, this is a public key.

This trait provides a uniform interface for different backends / implementations of the same cryptosystem.

Required Methods§

source

fn from_slice(raw: &[u8]) -> Result<Self>

Creates a key from raw bytes. Returns an error if the bytes do not represent a valid key.

source

fn as_bytes(&self) -> Cow<'_, [u8]>

Returns the key as raw bytes.

Implementations should return Cow::Borrowed whenever possible (that is, if the bytes are actually stored within the implementing data structure).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl VerifyingKey<Ed25519> for PublicKey

source§

fn from_slice(raw: &[u8]) -> Result<Self>

source§

fn as_bytes(&self) -> Cow<'_, [u8]>

source§

impl VerifyingKey<Es256> for VerifyingKey

source§

fn as_bytes(&self) -> Cow<'_, [u8]>

Serializes the key as a 33-byte compressed form.

source§

fn from_slice(raw: &[u8]) -> Result<Self>

source§

impl VerifyingKey<Es256k> for PublicKey

source§

fn as_bytes(&self) -> Cow<'_, [u8]>

Serializes the key as a 33-byte compressed form, as per Self::serialize().

source§

fn from_slice(raw: &[u8]) -> Result<Self>

Implementors§