JAVA - Blowfish加密出现java.security.InvalidKeyException: Illegal key size 解决方案

最近用java进行一个blowfish的加密算法,但是在我们的eclipse上报出Illegal key size的错误。google后发现原因是:ymmetricDS加密symmetric.properties中数据库密码产生"Illegal Key Size"错误

根据symmetricDS的guide文档,想要加密symmetric.properties中的db.password,需要跑以下命令:

sym -p E:\someplace\symmetric.properties -e dbpassword

中文版的JDK会出现"Illegal Key Size" 错误, 这是由于美国对加密的进出口限制,不允许高于56位的加密。

 

=========================================================================================================

解决方案:

  • 只要替换 jdk 与 jre 下两个 jar 包:local_policy.jar 和 US_export_policy.jar 即可,具体为什么可以 google 到
    • jdk 对应 jar 包的路径:D:\Java\jdk1.7.0_25\jre\lib\security
    • jre对应 jar 包的路径:D:\Java\jre7\lib\security

       

    • 下载地址:http://www.evernote.com/shard/s210/sh/e8bbe157-37c2-4e1f-888c-25124d65bdf0/7e245f4f0c0b5d6cf4fd6f9c3e160a61
posted on 2014-06-08 11:57  强巴拉  阅读(493)  评论(0编辑  收藏  举报