Replacing Bouncy Castle With JsafeJCE Provider
Hi,
I have replaced bouncy castle provider with JsafeJCE, got an exception saying InvalidKeySpecException
java.security.spec.InvalidKeySpecException: Could not decode key from BER. (Invalid encoding: expected tag not there.)
com.rsa.cryptoj.f.eW.b(Unknown Source)
com.rsa.cryptoj.f.eW.engineGeneratePrivate(Unknown Source)
java.security.KeyFactory.generatePrivate(KeyFactory.java:336)
Same code works fine with BouncyCastle...
below is the snippet
KeyFactory fact = KeyFactory.getInstance("RSA",JsafeJCE.BASE_PROVIDER_NAME);
PrivateKey privateKey = fact.generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString.getBytes())) );
PublicKey publicKey = certificate.getPublicKey();
Any Help is appreciated... Thanks in advance