Writing code to generate digital certificate
Here is the piece of code causing problem
PBEKeySpec keySpec = new PBEKeySpec(password);
SecretKeyFactory keyFactory = SecretKeyFactory
.getInstance("PBEWITHMD5ANDTRIPLEDES"/* "PBEWithSHAAndTwofish-CBC" */);
SecretKey key = keyFactory.generateSecret(keySpec);
PBEParameterSpec paramSpec = new PBEParameterSpec(salt,
MD5_ITERATIONS);
Cipher cipher = Cipher.getInstance("PBEWITHMD5ANDTRIPLEDES");
cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);//here Ex.
byte[] ciphertext = cipher.doFinal(plaintext);
Facing the exception
java.security.InvalidKeyException: Illegal key size
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1023)
at javax.crypto.Cipher.implInit(Cipher.java:789)
at javax.crypto.Cipher.chooseProvider(Cipher.java:848)
at javax.crypto.Cipher.init(Cipher.java:1347)
at javax.crypto.Cipher.init(Cipher.java:1281)
at chapter4.GenSig.passwordEncrypt(GenSig.java:290)
at chapter4.GenSig.generateKeyPair(GenSig.java:92)
at chapter4.GenSig.main(GenSig.java:48)
As I tried to search on internet with the exception name ,Almost all solution said one solution (install JCE) add the below jars in security folder of jre
and jdk i'm using
local_policy.jar
US_export_policy
Added those jar's and restarted my machine,Still the same issue and posting.
Let me know If you need further details.
Thanks for your time.