I am trying to remove the spongy castle provider from my cryptography class and to use the Spongy castle light library directly (maven:com.madgag:sc-light-jdk15on:1.47.0.3) I have a problem during changing a RSA encrypt logic, below is the code :
Original Code:
final PublicKey pKey = KeyFactory.getInstance("RSA", "SC").generatePublic(new X509EncodedKeySpec(publicKey));
final Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
Modified Code:
AsymmetricKeyParameter asypublicKey = PublicKeyFactory.createKey(publicKey);
org.spongycastle.crypto.encodings.PKCS1Encoding e = new org.spongycastle.crypto.encodings.PKCS1Encoding(new RSAEngine());
e.init(true, asypublicKey);
the above code seems to be not equal as before. Can anyone tell me the equivalent of the orginal code I can rewrite with spongycastle library without using Javax.Crypto library?
Thx