String keyTransportAlgorithm = encryptedKey.getEncryptionMethod().getAlgorithm();
if (EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP.equals(keyTransportAlgorithm)) {
List<XMLObject> digestMethods =
encryptedKey.getEncryptionMethod().getUnknownXMLObjects(DigestMethod.DEFAULT_ELEMENT_NAME);
if (!digestMethods.isEmpty()) {
DigestMethod dm = (DigestMethod) digestMethods.get(0);
if (! SignatureConstants.ALGO_ID_DIGEST_SHA1
.equals(DatatypeHelper.safeTrimOrNullString(dm.getAlgorithm())) ) {
log.error("EncryptedKey/EncryptionMethod/DigestMethod contains unsupported algorithm URI: {}",
dm.getAlgorithm());
throw new DecryptionException(
"EncryptedKey/EncryptionMethod/DigestMethod contains unsupported algorithm URI");
}
}
}