public class SignatureEcBcWithRecoveryId extends SignatureEcBc implements SignatureWithPublicKeyRecovery
SignatureEcBc with an extra byte for the recovery ID. Allows to
recover the public key. This enables to transfer only a
compact hash of the public key to save capacity. E.g. BitCoin uses this to transmit a BitCoin Address instead of the
actual public key.| Modifier and Type | Field and Description |
|---|---|
static byte |
BITCOIN_COMPRESSED_OFFSET
Additional
recovery offset used for BitCoin for compressed public key. |
static byte |
BITCOIN_RECOVERY_OFFSET
recovery offset used for BitCoin. |
private static int |
HEAD |
private byte |
recoveryOffset |
| Modifier | Constructor and Description |
|---|---|
protected |
SignatureEcBcWithRecoveryId(CryptoEllipticCurveBc curve,
byte[] data,
BigInteger r,
BigInteger s,
byte recoveryOffset)
The constructor.
|
|
SignatureEcBcWithRecoveryId(CryptoEllipticCurveBc curve,
byte[] data,
byte recoveryOffset)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
getHead() |
byte |
getRecoveryId() |
byte |
getRecoveryIndex() |
protected byte |
getRecoveryOffset() |
boolean |
isCompressed() |
static SignatureEcBcWithRecoveryId |
of(CryptoEllipticCurveBc curve,
BigInteger r,
BigInteger s,
byte[] message,
org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey publicKey,
byte recoveryOffset) |
org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey |
recoverPublicKey(byte[] message) |
calculateRecoveryIndex, createData, deserialize, getCurve, getR, getS, recoverPublicKey, recoverPublicKeyasStream, equals, format, formatBase64, formatHex, getData, getData, getDataByte, getLength, getMaxLength, getMinLength, hashCode, isZeros, parseBase64, parseHex, save, toBytes, toBytes, toInt, toLong, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final byte BITCOIN_RECOVERY_OFFSET
recovery offset used for BitCoin. Nobody knows why this magic number was chosen.public static final byte BITCOIN_COMPRESSED_OFFSET
recovery offset used for BitCoin for compressed public key.private static final int HEAD
private final byte recoveryOffset
protected SignatureEcBcWithRecoveryId(CryptoEllipticCurveBc curve, byte[] data, BigInteger r, BigInteger s, byte recoveryOffset)
curve - the elliptic curve.data - the binary data.r - - see SignatureEcBc.getR().s - - see SignatureEcBc.getS().recoveryOffset - the recovery offset.public SignatureEcBcWithRecoveryId(CryptoEllipticCurveBc curve, byte[] data, byte recoveryOffset)
curve - the elliptic curve.data - the binary data.recoveryOffset - the recovery offset.protected int getHead()
getHead in class SignatureEcBcbinary data.public byte getRecoveryId()
recovery index and compression information.public byte getRecoveryIndex()
recover the public key from the signature. It is a value in
the range from 0 to 3.protected byte getRecoveryOffset()
recovery index for building the
recovery ID.public boolean isCompressed()
true if public key was compressed, false otherwise.public org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey recoverPublicKey(byte[] message)
recoverPublicKey in interface SignatureWithPublicKeyRecoverymessage - the payload (typically hash of message) that was signed when this signature was created.public static SignatureEcBcWithRecoveryId of(CryptoEllipticCurveBc curve, BigInteger r, BigInteger s, byte[] message, org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey publicKey, byte recoveryOffset)
curve - the elliptic curve.r - the value r.s - the value s.message - the signed message (hash).publicKey - the BCECPublicKey that was used to sign the message.recoveryOffset - the recovery offset.Copyright © 2001–2019 mmm-Team. All rights reserved.