public boolean verifySignature(Map<String, String> parsedMessage, PublicKey publicKey) {
        String version = parsedMessage.get(SIGNATURE_VERSION);
        String type = parsedMessage.get(TYPE);
        String signature = parsedMessage.get(SIGNATURE);

        if (version == null || type == null || signature == null) {
            throw new RuntimeException("Message cannot have null values");
        }

        // construct the canonical signed string
        String signed;
        if (type.equals(NOTIFICATION_TYPE)) {
            signed = stringToSign(publishMessageValues(parsedMessage));
        } else if (type.equals(SUBSCRIBE_TYPE)) {
            signed = stringToSign(subscribeMessageValues(parsedMessage));
        } else if (type.equals(UNSUBSCRIBE_TYPE)) {
            signed = stringToSign(subscribeMessageValues(parsedMessage)); // no difference, for now
        } else {
            throw new RuntimeException("Cannot process message of type " + type);
        }
        return verifySignature(signed, signature, SignatureVersion.fromValue(version), publicKey);
    }
Validates the signature on a Simple Notification Service message. No
Amazon-specific dependencies, just plain Java crypto

@param parsedMessage
           A map of Simple Notification Service message.
@param publicKey
           The Simple Notification Service public key, exactly as you'd
           see it when retrieved from the cert.

@return True if the message was correctly validated, otherwise false.
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/util/SignatureChecker.java