wallet::DecryptKey

Decrypts an encrypted private key and validates it against its public key.

Synopsis

Declared in <wallet/crypter.h>

[[nodiscard]]
bool
DecryptKey(
    CKeyingMaterial const& master_key,
    std::span<unsigned char const> crypted_secret,
    CPubKey const& pub_key,
    CKey& key);

Return Value

true if the key was decrypted and matches the public key.

NOTE

The return value should not be discarded.

Parameters

NameDescription
master_keyThe master key used to decrypt the private key.
crypted_secretThe encrypted private key.
pub_keyThe public key the decrypted key must match.
keyReceives the recovered private key.