bouncycastle provider can't find classes needed for algorithm

后端 未结 3 1894
[愿得一人]
[愿得一人] 2020-12-25 12:53

I\'m trying to use bouncycastle to encrypt a file using a public key. I\'ve registered the provider programatically:

Security.addProvider(new BouncyCastlePro         


        
3条回答
  •  滥情空心
    2020-12-25 13:17

    You have a BouncyCastle Security provider installation problem, you need to either

    • Add BouncyCastle to the JRE/JDK $JAVA_HOME/jre/lib/security/java.security file as a provider (be sure that you add it to the JRE you use when running, eg. if you have multiple JRE's/JDK's installed)

    eg.

    security.provider.2=org.bouncycastle.jce.provider.BouncyCastleProvider
    

    (and renumber the security providers below it - don't put it as the highest priority provider).

    • or you can add BouncyCastle programmatically, as you were trying to do above, but in this case the security policy $JAVA_HOME/jre/lib/security/java.policy should be "unlimited" (you can probably download an unlimited policy file from the Java homepage).

提交回复
热议问题