Skip to main content

SecretKey

Trait SecretKey 

Source
pub trait SecretKey<'a, const KEY_LEN: usize, const PUB_KEY_LEN: usize, const SIGNATURE_LEN: usize, const SHARED_SECRET_LEN: usize>: SigningSecretKey<'a, PUB_KEY_LEN, SIGNATURE_LEN> {
    // Required methods
    fn derive_shared_secret(
        &self,
        peer_pub_key: &Self::PublicKey<'a>,
        shared_secret: &mut CryptoSensitive<SHARED_SECRET_LEN>,
    ) -> Result<(), Error>;
    fn write_canon(
        &self,
        key: &mut CryptoSensitive<KEY_LEN>,
    ) -> Result<(), Error>;
}
Expand description

Trait representing a secret key.

A secret key can be used for signing operations, deriving shared secrets, and can be written to its canonical representation (exported).

Required Methods§

Source

fn derive_shared_secret( &self, peer_pub_key: &Self::PublicKey<'a>, shared_secret: &mut CryptoSensitive<SHARED_SECRET_LEN>, ) -> Result<(), Error>

Derive a shared secret with the given peer public key,

§Arguments
  • peer_pub_key: Peer public key to derive the shared secret with.
  • shared_secret: Buffer to write the shared secret into.
Source

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

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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<const KEY_LEN: usize, const PUB_KEY_LEN: usize, const SIGNATURE_LEN: usize, const SHARED_SECRET_LEN: usize> SecretKey<'_, KEY_LEN, PUB_KEY_LEN, SIGNATURE_LEN, SHARED_SECRET_LEN> for DummyCrypto