public class TransactionSignature extends ECKey.ECDSASignature
ECKey.ECDSASignature
and adds methods for handling
the additional SIGHASH mode byte that is used.Modifier and Type | Field and Description |
---|---|
int |
sighashFlags
A byte that controls which parts of a transaction are signed.
|
r, s
Constructor and Description |
---|
TransactionSignature(BigInteger r,
BigInteger s)
Constructs a signature with the given components and SIGHASH_ALL.
|
TransactionSignature(BigInteger r,
BigInteger s,
int sighashFlags)
Constructs a signature with the given components and raw sighash flag bytes (needed for rule compatibility).
|
TransactionSignature(ECKey.ECDSASignature signature,
Transaction.SigHash mode,
boolean anyoneCanPay)
Constructs a transaction signature based on the ECDSA signature.
|
Modifier and Type | Method and Description |
---|---|
boolean |
anyoneCanPay() |
static int |
calcSigHashValue(Transaction.SigHash mode,
boolean anyoneCanPay)
Calculates the byte used in the protocol to represent the combination of mode and anyoneCanPay.
|
static TransactionSignature |
decodeFromBitcoin(byte[] bytes,
boolean requireCanonicalEncoding)
Deprecated.
use
#decodeFromBitcoin(byte[], boolean, boolean instead}. |
static TransactionSignature |
decodeFromBitcoin(byte[] bytes,
boolean requireCanonicalEncoding,
boolean requireCanonicalSValue)
Returns a decoded signature.
|
static TransactionSignature |
dummy()
Returns a dummy invalid signature whose R/S values are set such that they will take up the same number of
encoded bytes as a real signature.
|
byte[] |
encodeToBitcoin()
What we get back from the signer are the two components of a signature, r and s.
|
static boolean |
isEncodingCanonical(byte[] signature)
Returns true if the given signature is has canonical encoding, and will thus be accepted as standard by
Bitcoin Core.
|
Transaction.SigHash |
sigHashMode() |
ECKey.ECDSASignature |
toCanonicalised()
Will automatically adjust the S component to be less than or equal to half the curve order, if necessary.
|
decodeFromDER, derByteStream, encodeToDER, equals, hashCode, isCanonical
public final int sighashFlags
public TransactionSignature(BigInteger r, BigInteger s)
public TransactionSignature(BigInteger r, BigInteger s, int sighashFlags)
public TransactionSignature(ECKey.ECDSASignature signature, Transaction.SigHash mode, boolean anyoneCanPay)
public static TransactionSignature dummy()
public static int calcSigHashValue(Transaction.SigHash mode, boolean anyoneCanPay)
public static boolean isEncodingCanonical(byte[] signature)
public boolean anyoneCanPay()
public Transaction.SigHash sigHashMode()
public byte[] encodeToBitcoin()
public ECKey.ECDSASignature toCanonicalised()
ECKey.ECDSASignature
toCanonicalised
in class ECKey.ECDSASignature
@Deprecated public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonicalEncoding) throws VerificationException
#decodeFromBitcoin(byte[], boolean, boolean
instead}.requireCanonicalEncoding
- if the encoding of the signature must
be canonical.RuntimeException
- if the signature is invalid or unparseable in some way.VerificationException
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonicalEncoding, boolean requireCanonicalSValue) throws VerificationException
requireCanonicalEncoding
- if the encoding of the signature must
be canonical.requireCanonicalSValue
- if the S-value must be canonical (below half
the order of the curve).RuntimeException
- if the signature is invalid or unparseable in some way.VerificationException
Copyright © 2016. All rights reserved.