public static void verifyMessage(final Address address,
                                     final String message,
                                     final String signatureBase64) throws SignatureException {
        try {
            final ScriptType scriptType = address.getOutputScriptType();

            switch (scriptType) {
                case P2PKH:
                case P2WPKH:
                    comparePubKeyHash(address, message, signatureBase64);
                    break;
                case P2SH:
                    compareP2SHScriptHashDerivedFromPubKey((LegacyAddress) address, message, signatureBase64);
                    break;
                default:
                    throw new SignatureException(SIGNATURE_FAILED_ERROR_MESSAGE);
            }

        } catch (final SignatureException se) {
            throw se;
        } catch (final Exception e) {
            log.warn("verifying of message signature failed with exception", e);
            throw new SignatureException(SIGNATURE_FAILED_ERROR_MESSAGE);
        }
    }
@Test
    public void testMessageSignatureVerification() {
        final AddressParser addressParser = AddressParser.getDefault(testVector.networkParameters.network());
        try {
            MessageVerifyUtils.verifyMessage(
                    addressParser.parseAddress(testVector.address),
                    testVector.message,
                    testVector.signature
            );
            if (!testVector.shouldVerify) {
                fail("verification should have failed, but succeed: " + testVector + "\n");
            }
        } catch (Exception e) {
            if (testVector.shouldVerify) {
                fail("verification should have succeeded, but failed: " + testVector + "\n");
            }
        }
    }