IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    AES256算法遇到 Illegal key size or default parameters的解决办法

    蔡晓建 (mc02cxj@gmail.com)发表于 2015-12-16 00:00:00
    love 0
    1
    2
    3
    4
    5
    6
    7
    8
    
    java.security.InvalidKeyException: Illegal key size or default parameters
      at javax.crypto.Cipher.a(DashoA13*..)
      at javax.crypto.Cipher.a(DashoA13*..)
      at javax.crypto.Cipher.a(DashoA13*..)
      at javax.crypto.Cipher.init(DashoA13*..)
      at javax.crypto.Cipher.init(DashoA13*..)
      at com.xxx.AESWithFileKey.encrypt(AESWithFileKey.java:81)
      at com.xxx.AESWithFileKey.main(AESWithFileKey.java:148)
    

    Google到问题原因,链接地址如下:http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters

    根据回答找到下载新jar包链接地址如下:http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html
    把里面的两个jar包:local_policy.jar 和 US_export_policy.jar 替换掉原来安装目录C:\Program Files\Java\jre6\lib\security 下的两个jar包就可以了

    上面是在oracle的jdk出现的。 如果是IBM的jdk出现问题,参考调整 Version 7.0 应用程序的 Web Services Security



沪ICP备19023445号-2号
友情链接