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§
Sourcefn public_key(&self) -> C::PublicKey
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.
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.