mundane::public

Trait PrivateKey

Source
pub trait PrivateKey: Sealed + Sized {
    type Public: PublicKey<Private = Self>;

    // Required method
    fn public(&self) -> Self::Public;

    // Provided method
    fn sign<S: Signature<PrivateKey = Self>>(
        &self,
        message: &[u8],
    ) -> Result<S, Error> { ... }
}
Expand description

The private component of a public/private key pair.

Required Associated Types§

Source

type Public: PublicKey<Private = Self>

The type of the public component.

Required Methods§

Source

fn public(&self) -> Self::Public

Gets the public key corresponding to this private key.

Provided Methods§

Source

fn sign<S: Signature<PrivateKey = Self>>( &self, message: &[u8], ) -> Result<S, Error>

Signs a message with this private key.

sign signs a message with this key using the signature scheme S. It is equivalent to S::sign(self, message).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§