Class MessageVerifyUtils

  • public class MessageVerifyUtils
    extends java.lang.Object
    Small utility class for verifying signatures of text messages created with Bitcoin addresses (more precisely: with the private key of Bitcoin addresses). Supports verifying of signatures created with:
    • P2PKH addresses (old legacy 1… addresses)
    • P2WPKH addresses (native segwit v0 addresses, aka bc1q… addresses)
    • P2SH-P2WPKH addresses (segwit wrapped into P2SH, aka legacy segwit addresses, like 3…)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void verifyMessage​(Address address, java.lang.String message, java.lang.String signatureBase64)
      Verifies messages signed with private keys of Bitcoin addresses.
      • Methods inherited from class java.lang.Object

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


        public static final java.lang.String SIGNATURE_FAILED_ERROR_MESSAGE
        See Also:
        Constant Field Values
    • Method Detail

      • verifyMessage

        public static void verifyMessage​(Address address,
                                         java.lang.String message,
                                         java.lang.String signatureBase64)
        Verifies messages signed with private keys of Bitcoin addresses.
        address - bitcoin address used to create the signature
        message - message which has been signed
        signatureBase64 - signature as base64 encoded string
        Throws: - if the signature does not match the message and the address