Package org.bitcoinj.crypto.utils
Class MessageVerifyUtils
- java.lang.Object
-
- org.bitcoinj.crypto.utils.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…)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SIGNATURE_FAILED_ERROR_MESSAGE
-
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.
-
-
-
Field Detail
-
SIGNATURE_FAILED_ERROR_MESSAGE
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) throws java.security.SignatureException
Verifies messages signed with private keys of Bitcoin addresses.- Parameters:
address
- bitcoin address used to create the signaturemessage
- message which has been signedsignatureBase64
- signature as base64 encoded string- Throws:
java.security.SignatureException
- if the signature does not match the message and the address
-
-