美文网首页
Cannot find any provider support

Cannot find any provider support

作者: DD_Dog | 来源:发表于2022-04-18 14:33 被阅读0次

    Java使用AES/CBC/PKCS7Padding时会报错,因为原生JDK不支持。
    修改方法很简简单单,两步:
    1、添加算法的jar包bcprov-jdk16-1.46.jar
    2、配置使jar包生效

    添加jar包

    下载bcprov-jdk16-1.46.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,完事!

    相关文章

      网友评论

          本文标题:Cannot find any provider support

          本文链接:https://www.haomeiwen.com/subject/sjsdertx.html