Trait iop_keyvault::PrivateKey[][src]

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

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

fn public_key(&self) -> C::PublicKey[src]

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.

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

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

Loading content...

Implementors

impl PrivateKey<Ed25519> for EdPrivateKey[src]

impl PrivateKey<MultiCipher> for MPrivateKey[src]

impl PrivateKey<Secp256k1> for SecpPrivateKey[src]

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

Panics

There is a 2^-256 chance this message cannot be signed by this key. The C implementation in bitcoin does not fail, but this pure rust version does. Then we panic.

Loading content...