mirror of https://github.com/apache/jclouds.git
override bRSA algorithm identifier with string the BouncyCastle expects
This commit is contained in:
parent
1d3ee50aad
commit
6688f5aa30
|
@ -21,6 +21,8 @@ package org.jclouds.encryption.bouncycastle;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.NoSuchPaddingException;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
@ -37,4 +39,14 @@ public class BouncyCastleCrypto extends JCECrypto {
|
||||||
super(new BouncyCastleProvider());
|
super(new BouncyCastleProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******
|
||||||
|
* Override the standard implementation to convert the "RSA" algorithm to the String that bouncycastle expects.
|
||||||
|
* See org.jclouds.encryption.bouncycastle.BouncyCastlePasswordDecryptionTest for how this effects password decryption.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Cipher cipher(String algorithm) throws NoSuchAlgorithmException, NoSuchPaddingException {
|
||||||
|
return super.cipher("RSA".equals(algorithm) ? "RSA/NONE/PKCS1Padding" : algorithm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue