Package org.bitcoinj.wallet
Class DecryptingKeyBag
java.lang.Object
org.bitcoinj.wallet.DecryptingKeyBag
- All Implemented Interfaces:
KeyBag
A DecryptingKeyBag filters a pre-existing key bag, decrypting keys as they are requested using the provided
AES key. If the keys are encrypted and no AES key provided,
ECKey.KeyIsEncryptedException
will be thrown.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindKeyFromPubKey
(byte[] pubKey) Locates a keypair from the keychain given the raw public key bytes.findKeyFromPubKeyHash
(byte[] pubKeyHash, ScriptType scriptType) Locates a keypair from the keychain given the hash of the public key, and (optionally) by usage for a specific script type.findRedeemDataFromScriptHash
(byte[] scriptHash) Locates a redeem data (redeem script and keys) from the keychain given the hash of the script.
-
Field Details
-
target
-
aesKey
-
-
Constructor Details
-
DecryptingKeyBag
-
-
Method Details
-
findKeyFromPubKeyHash
Description copied from interface:KeyBag
Locates a keypair from the keychain given the hash of the public key, and (optionally) by usage for a specific script type. This is needed when finding out which key we need to use to redeem a transaction output.- Specified by:
findKeyFromPubKeyHash
in interfaceKeyBag
- Parameters:
pubKeyHash
- hash of the keypair to look forscriptType
- only look for given usage (currentlyScriptType.P2PKH
orScriptType.P2WPKH
) ornull
if we don't care- Returns:
- found key or null if no such key was found.
-
findKeyFromPubKey
Description copied from interface:KeyBag
Locates a keypair from the keychain given the raw public key bytes.- Specified by:
findKeyFromPubKey
in interfaceKeyBag
- Returns:
- ECKey or null if no such key was found.
-
findRedeemDataFromScriptHash
Description copied from interface:KeyBag
Locates a redeem data (redeem script and keys) from the keychain given the hash of the script. This is needed when finding out which key and script we need to use to locally sign a P2SH transaction input. It is assumed that wallet should not have more than one private key for a single P2SH tx for security reasons. Returns RedeemData object or null if no such data was found.- Specified by:
findRedeemDataFromScriptHash
in interfaceKeyBag
-