ExtendedPrivateKey

Trait ExtendedPrivateKey 

Source
pub trait ExtendedPrivateKey<C: KeyDerivationCrypto + ?Sized>: Clone {
    // Required methods
    fn derive_normal_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>;
    fn derive_hardened_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>;
    fn neuter(&self) -> C::ExtendedPublicKey;
    fn private_key(&self) -> C::PrivateKey;
}
Expand description

Extended private key not only contains a private key, but also a chain code that is some additional entropy that is used to derive child keys. Some cryptographic suites implement both normal (public) and hardened (private) derivation, some, like Ed25519 is missing normal derivation and just err when called.

An extended private key can be neutered to an extended public key, which contains the same chain code, but its public key part does not reveal any information about the private key.

Required Methods§

Source

fn derive_normal_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>

Normal derivation allows the neutered extended public key to calculate child extended public keys without revealing any private keys.

Source

fn derive_hardened_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>

Hardened derivation makes it impossible to the neutered extended public key to calculate children. It uses a different derivation algorithm.

Source

fn neuter(&self) -> C::ExtendedPublicKey

Neutering an extended private key gives an extended public key that contains the private key neutered, plus the chain code. It is useless to reveal the chain code when hardened derivation is used.

Source

fn private_key(&self) -> C::PrivateKey

Throws away the chain code and gives back only the private key from the extended private key.

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§