PrivateKey

Trait PrivateKey 

Source
pub trait PrivateKey<C: AsymmetricCrypto + ?Sized>: Clone {
    // Required methods
    fn public_key(&self) -> C::PublicKey;
    fn sign<D: AsRef<[u8]>>(&self, data: D) -> C::Signature;
}
Expand description

A private key (also called secret key or sk in some literature) is the part of an asymmetric keypair which is never shared with anyone. It is used to sign a message sent to any recipient or to decrypt a message that was sent encrypted from any recipients.

Required Methods§

Source

fn public_key(&self) -> C::PublicKey

Calculates the PublicKey that belongs to this private key. These two keys together form an asymmetric keypair, where the private key cannot be calculated from the public key with a reasonable effort, but the public key can be calculated from the private key cheaply.

Source

fn sign<D: AsRef<[u8]>>(&self, data: D) -> C::Signature

Calculates the signature of a message that can be then verified using PublicKey::verify

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§