WebSphere加密获取Java.Security.invalidKeyException:非法键尺寸错误

发布于 2025-01-27 23:47:45 字数 732 浏览 3 评论 0原文

试图加密字符串并作为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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海夕 2025-02-03 23:47:45

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文