Java使用AES/CBC/PKCS7Padding
时会报错,因为原生JDK不支持。
修改方法很简简单单,两步:
1、添加算法的jar包bcprov-jdk16-1.46.jar
2、配置使jar包生效
添加jar包
添加到jdk目录jdk_path/jre/lib/ext
配置生效
修改jdk_path/jre/lib/security/java.security
#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=sun.security.ec.SunEC
security.provider.4=com.sun.net.ssl.internal.ssl.Provider
security.provider.5=com.sun.crypto.provider.SunJCE
security.provider.6=sun.security.jgss.SunProvider
#security.provider.7=com.sun.security.sasl.Provider #注释这一行
security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider #添加这一行
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.9=sun.security.smartcardio.SunPCSC
OK,完事!
网友评论