java.lang.UnsupportedOperationException at javax.crypto.CipherSpi.engineGetKeySize

Unlimited Strength Java(TM) Cryptography Extension (JCE)
Unlimited Strength Java(TM) Cryptography
Extension (JCE)

java.lang.UnsupportedOperationException at javax.crypto.CipherSpi.engineGetKeySize的原因是默认的jdk的key长度有128bit限制,所以需要把这个长度限制放宽。官方有个无长度限制版的JCE jar包,下载地址:

jdk6:http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

jdk7:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

解压后,将两个jar包(local_policy.jar、US_export_policy.jar)放在如下的目录下:

<java-home>/lib/security              [Unix]
<java-home>/jre/lib/security        [Unix]

<java-home>\lib\security              [Win32]
<java-home>\jre\lib\security        [Win32]

Reference

http://docs.oracle.com/javase/1.5.0/docs/guide/security/jce/JCERefGuide.html#Introduction

local_policy.jar and US_export_policy.jar different with Unlimited Strength Vs Default.

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

− four = five