added use of OAEP and RSA/ECB/OAEPPadding to provide better support for SunJCE (relates to github
asymmetricWrapperAlgNames.put(PKCSObjectIdentifiers.rsaEncryption, "RSA/ECB/PKCS1Padding");
asymmetricWrapperAlgNames.put(OIWObjectIdentifiers.elGamalAlgorithm, "Elgamal/ECB/PKCS1Padding");
+ asymmetricWrapperAlgNames.put(PKCSObjectIdentifiers.id_RSAES_OAEP, "RSA/ECB/OAEPPadding");
asymmetricWrapperAlgNames.put(CryptoProObjectIdentifiers.gostR3410_2001, "ECGOST3410");
@@ -264,13 +265,31 @@ Cipher createSymmetricWrapper(ASN1ObjectIdentifier algorithm)
AlgorithmParameters createAlgorithmParameters(AlgorithmIdentifier cipherAlgId)
throws OperatorCreationException
{
- AlgorithmParameters parameters;
+ AlgorithmParameters parameters = null;
if (cipherAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.rsaEncryption))
{
return null;
}
+ if (cipherAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSAES_OAEP))
+ {
+ try
+ {
+ parameters = helper.createAlgorithmParameters("OAEP");
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ // try below
+ }
+ catch (NoSuchProviderException e)
+ {
+ throw new OperatorCreationException("cannot create algorithm parameters: " + e.getMessage(), e);
+ }
+ }
+
+ if (parameters == null)
+ {
try
{
parameters = helper.createAlgorithmParameters(cipherAlgId.getAlgorithm().getId());
@@ -283,6 +302,7 @@ AlgorithmParameters createAlgorithmParameters(AlgorithmIdentifier cipherAlgId)
{
throw new OperatorCreationException("cannot create algorithm parameters: " + e.getMessage(), e);
}
+ }
try
{
