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

Name

Description

master_key

The master key used to decrypt the private key.

crypted_secret

The encrypted private key.

pub_key

The public key the decrypted key must match.

key

Receives the recovered private key.

Created with MrDocs