Skip to main content

PublicKey

Trait PublicKey 

Source
pub trait PublicKey<'a, const KEY_LEN: usize, const SIGNATURE_LEN: usize> {
    // Required methods
    fn verify(
        &self,
        data: &[u8],
        signature: CryptoSensitiveRef<'_, SIGNATURE_LEN>,
    ) -> Result<bool, Error>;
    fn write_canon(
        &self,
        key: &mut CryptoSensitive<KEY_LEN>,
    ) -> Result<(), Error>;
}
Expand description

Trait representing a public key.

Required Methods§

Source

fn verify( &self, data: &[u8], signature: CryptoSensitiveRef<'_, SIGNATURE_LEN>, ) -> Result<bool, Error>

Verify the given signature over the given data using this public key.

§Arguments
  • data: Data to verify the signature over.
  • signature: Signature to verify.
§Returns
  • true if the signature is valid.
Source

fn write_canon(&self, key: &mut CryptoSensitive<KEY_LEN>) -> Result<(), Error>

Write the canonical representation of this public key into the given buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a, const KEY_LEN: usize, const SIGNATURE_LEN: usize, T> PublicKey<'a, KEY_LEN, SIGNATURE_LEN> for &T
where T: PublicKey<'a, KEY_LEN, SIGNATURE_LEN>,

Source§

fn verify( &self, data: &[u8], signature: CryptoSensitiveRef<'_, SIGNATURE_LEN>, ) -> Result<bool, Error>

Source§

fn write_canon(&self, key: &mut CryptoSensitive<KEY_LEN>) -> Result<(), Error>

Implementors§

Source§

impl<const KEY_LEN: usize, const SIGNATURE_LEN: usize> PublicKey<'_, KEY_LEN, SIGNATURE_LEN> for DummyCrypto