Trait iop_keyvault::ExtendedPrivateKey
source · [−]pub trait ExtendedPrivateKey<C: KeyDerivationCrypto + ?Sized>: Clone {
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
fn derive_normal_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>
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.
fn derive_hardened_child(&self, idx: i32) -> Result<C::ExtendedPrivateKey>
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.
fn neuter(&self) -> C::ExtendedPublicKey
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.
fn private_key(&self) -> C::PrivateKey
fn private_key(&self) -> C::PrivateKey
Throws away the chain code and gives back only the private key from the extended private key.