WebSphere加密获取Java.Security.invalidKeyException:非法键尺寸错误
试图加密字符串并作为IBM WebSphere中的字节数组传递回到前端。按照以下内容的实现:
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");
但是,在尝试运行WebShpere上托管的应用程序时,我会收到以下错误消息:
java.security.InvalidKeyException: Illegal key size
当我按照正常的Java应用程序运行时,它可以正常运行。已经尝试了此解决方案 在WebSphere上设置配置,但不要未来。
有什么想法吗?谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Witch IBM JDK版本是WebSphere使用的。如果不是最新的,我认为您需要在WebSphere JDK中安装无限制的策略文件。
如何从IBM.com中安装WebSphere Application Server中的无限制SDK策略文件?
https://www.youtube.com/watch?v=nz6vjcqvdrc
您可以下载以下网站不受限制的策略文件:
https://www-01.ibm。 com/cromp处/iwm/iwm/web/pickurxnew.do?source = jcesdk
我希望这对
最好的问候有帮助
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