类 ECKey.ECDSASignature
- java.lang.Object
-
- network.nerve.core.crypto.ECKey.ECDSASignature
-
- 封闭类:
- ECKey
public static class ECKey.ECDSASignature extends Object
Groups the two components that make up a signature, and provides a way to encode to DER form, which is how ECDSA signatures are represented when embedded in other data structures in the Bitcoin protocol. The raw components can be useful for doing further EC maths on them.
-
-
字段概要
字段 修饰符和类型 字段 说明 BigIntegerrThe two components of the signature.BigIntegersThe two components of the signature.
-
构造器概要
构造器 构造器 说明 ECDSASignature(BigInteger r, BigInteger s)Constructs a signature with the given components.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static ECKey.ECDSASignaturedecodeFromDER(byte[] bytes)protected ByteArrayOutputStreamderByteStream()byte[]encodeToDER()DER is an international standard for serializing data structures which is widely used in cryptography.booleanequals(Object o)inthashCode()booleanisCanonical()Returns true if the S component is "low", that means it is belowECKey.HALF_CURVE_ORDER.ECKey.ECDSASignaturetoCanonicalised()Will automatically adjust the S component to be less than or equal to half the curve order, if necessary.
-
-
-
字段详细资料
-
r
public final BigInteger r
The two components of the signature.
-
s
public final BigInteger s
The two components of the signature.
-
-
构造器详细资料
-
ECDSASignature
public ECDSASignature(BigInteger r, BigInteger s)
Constructs a signature with the given components. Does NOT automatically canonicalise the signature.
-
-
方法详细资料
-
isCanonical
public boolean isCanonical()
Returns true if the S component is "low", that means it is belowECKey.HALF_CURVE_ORDER. See BIP62.
-
toCanonicalised
public ECKey.ECDSASignature toCanonicalised()
Will automatically adjust the S component to be less than or equal to half the curve order, if necessary. This is required because for every signature (r,s) the signature (r, -s (mod N)) is a valid signature of the same message. However, we dislike the ability to modify the bits of a Bitcoin transaction after it's been signed, as that violates various assumed invariants. Thus in future only one of those forms will be considered legal and the other will be banned.
-
encodeToDER
public byte[] encodeToDER()
DER is an international standard for serializing data structures which is widely used in cryptography. It's somewhat like protocol buffers but less convenient. This method returns a standard DER encoding of the signature, as recognized by OpenSSL and other libraries.
-
decodeFromDER
public static ECKey.ECDSASignature decodeFromDER(byte[] bytes)
- 抛出:
Exception- if the signature is unparseable in some way.
-
derByteStream
protected ByteArrayOutputStream derByteStream() throws IOException
- 抛出:
IOException
-
-