Class ECDSASignature


  • public class ECDSASignature
    extends java.lang.Object
    An ECDSA Signature.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.math.BigInteger r  
      java.math.BigInteger s  
    • Constructor Summary

      Constructors 
      Constructor Description
      ECDSASignature​(java.math.BigInteger r, java.math.BigInteger s)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isCanonical()  
      ECDSASignature toCanonicalised()
      Will automatically adjust the S component to be less than or equal to half the curve order, if necessary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • r

        public final java.math.BigInteger r
      • s

        public final java.math.BigInteger s
    • Constructor Detail

      • ECDSASignature

        public ECDSASignature​(java.math.BigInteger r,
                              java.math.BigInteger s)
    • Method Detail

      • isCanonical

        public boolean isCanonical()
        Returns:
        true if the S component is "low", that means it is below Sign.HALF_CURVE_ORDER. See BIP62.
      • toCanonicalised

        public 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.
        Returns:
        the signature in a canonicalised form.