src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgUtil.java
static boolean verifySignature(String rawResponse, String base64Sig) {
        try {
            final String randomObj;
            try {
                ObjectMapper mapper = new ObjectMapper();
                JsonNode jsonNode = mapper.readTree(rawResponse);
                ObjectNode randomNode = (ObjectNode) jsonNode.findValue("result").findValue("random");
                randomObj = mapper.writeValueAsString(randomNode);
            } catch (Exception e) {
                return false;
            }

            return verifyRSA(parsePublicKey(new Base64().decode(RANDOM_ORG_PUB_KEY)), randomObj.getBytes(StandardCharsets.UTF_8), new Base64().decode(base64Sig));
        } catch (Exception e) {
            throw new IllegalStateException("could not verify signature", e);
        }
    }
/**
     * Parses the correct property from the raw response and verifies it against random.org
     * public key
     *
     * @param rawResponse the whole raw response as string
     * @param base64Sig   base64 encoded signature from the server response
     * @return true if could be verified
     */
Parses the correct property from the raw response and verifies it against random.org
public key

@param rawResponse the whole raw response as string
@param base64Sig   base64 encoded signature from the server response
@return true if could be verified
Parses the correct property from the raw response and verifies it against random . org public key @param rawResponse the whole raw response as string @param base64Sig base64 encoded signature from the server response @return true if could be verified
static boolean verifySignature(String rawResponse, String base64Sig) {
        try {
            final String randomObj;
            try {
                ObjectMapper mapper = new ObjectMapper();
                JsonNode jsonNode = mapper.readTree(rawResponse);
                ObjectNode randomNode = (ObjectNode) jsonNode.findValue("result").findValue("random");
                randomObj = mapper.writeValueAsString(randomNode);
            } catch (Exception e) {
                return false;
            }
            return verifyRSA(parsePublicKey(new Base64().decode(RANDOM_ORG_PUB_KEY)), randomObj.getBytes(StandardCharsets.UTF_8), new Base64().decode(base64Sig));
        } catch (Exception e) {
            throw new IllegalStateException("could not verify signature", e);
        }
    }
static boolean verifySignature ( String rawResponse , String base64Sig ) { try { final String randomObj ; try { ObjectMapper mapper = new ObjectMapper ( ) ; JsonNode jsonNode = mapper . readTree ( rawResponse ) ; ObjectNode randomNode = ( ObjectNode ) jsonNode . findValue ( "result" ) . findValue ( "random" ) ; randomObj = mapper . writeValueAsString ( randomNode ) ; } catch ( Exception e ) { return false ; } return verifyRSA ( parsePublicKey ( new Base64 ( ) . decode ( RANDOM_ORG_PUB_KEY ) ) , randomObj . getBytes ( StandardCharsets . UTF_8 ) , new Base64 ( ) . decode ( base64Sig ) ) ; } catch ( Exception e ) { throw new IllegalStateException ( "could not verify signature" , e ) ; } }
Parses the correct property from the raw response and verifies it against random.org
 public key
Parses the correct property from the raw response and verifies it against random . org public key