in src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyRequestValidator.java [219:253]
private String decodeMessage(String prefix, String url, String body, String requestHash)
throws IOException {
if (trustEnabled) {
String bodyHash = hash(prefix + url + ":" + body);
if (bodyHash.equals(requestHash)) {
if (encryptionEnabled) {
try {
JsonObject json = Json.createReader(new StringReader(body)).readObject();
if (json.containsKey("payload")) {
return decrypt(json.getJsonArray("payload"));
}
} catch (JsonException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (InvalidKeyException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (IllegalBlockSizeException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (BadPaddingException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (NoSuchAlgorithmException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (NoSuchPaddingException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (InvalidAlgorithmParameterException e) {
throw new IOException("Encrypted Message is in the correct json format");
} catch (InvalidKeySpecException e) {
throw new IOException("Encrypted Message is in the correct json format");
}
}
}
throw new IOException("Message is not valid, hash does not match message");
}
return body;
}