'Websphere Encryption getting java.security.InvalidKeyException: Illegal key size Error
Was trying to encrypt string and pass back to front end as byte array in IBM Websphere. Implementation as per following:
import sc.core.utils.CryptoUtil;
String msgKey = CryptoUtil.randomString();
String salt = CryptoUtil.generateSaltKey();
String passphrase = CryptoUtil.getHashSHA512(msgKey);
byte[] cipherText = CryptoUtil.encryptWithAlias(nrRecord.getBytes(), passphrase, salt, "CDC");
However, I am getting following error message when trying to run the application hosted on webshpere:
java.security.InvalidKeyException: Illegal key size
WHen I ran as normal Java application, it works fine. Have tried this solution to set configuration on websphere but to no futile.
Any ideas? Thanks!
Solution 1:[1]
Witch IBM JDK version is Websphere using. If it is not one of the latest ones I think you would need to install the unrestricted policy files in the Websphere JDK.
How do I install the unrestricted SDK policy files in WebSphere Application Server from IBM.com? https://www.youtube.com/watch?v=Nz6vJCqvDrc
You can download the unrestricted policy files from the following site: https://www-01.ibm.com/marketing/iwm/iwm/web/pickUrxNew.do?source=jcesdk
I hope this helps
Best Regards
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Miguel Angel Camacho |
