in src/main/java/org/apache/xml/security/encryption/XMLCipher.java [1672:1731]
private Cipher constructCipher(String algorithm, String digestAlgorithm, Exception nsae) throws XMLEncryptionException {
if (!XMLCipher.RSA_OAEP.equals(algorithm)) {
throw new XMLEncryptionException(nsae);
}
if (digestAlgorithm == null
|| MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1.equals(digestAlgorithm)) {
try {
if (requestedJCEProvider == null) {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
} else {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException(ex);
}
} else if (MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA224.equals(digestAlgorithm)) {
try {
if (requestedJCEProvider == null) {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-224andMGF1Padding");
} else {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-224andMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException(ex);
}
} else if (MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256.equals(digestAlgorithm)) {
try {
if (requestedJCEProvider == null) {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
} else {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException(ex);
}
} else if (MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384.equals(digestAlgorithm)) {
try {
if (requestedJCEProvider == null) {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-384AndMGF1Padding");
} else {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-384AndMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException(ex);
}
} else if (MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512.equals(digestAlgorithm)) {
try {
if (requestedJCEProvider == null) {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-512AndMGF1Padding");
} else {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA-512AndMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException(ex);
}
} else {
throw new XMLEncryptionException(nsae);
}
}