通过
动态和静态地注册BC提供程序后,通过错误日志获取上述异常Security.addProvider(new BouncyCastleProvider());
但是,
Cipher.getInstance("AES/CTS/NoPadding", "BC")
我收到以下错误
Failure to decrypt: bad encryption:
java.lang.SecurityException: JCE cannot authenticate the provider BC
Caused by: java.util.jar.JarException:
file:/space/uploads/unittest/jars/myjar.jar has unsigned entries - <some-location>/README.txt
at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:500)
at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:361)
at javax.crypto.JarVerifier.verify(JarVerifier.java:289)
at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:159)
at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:185)
at javax.crypto.Cipher.getInstance(Cipher.java:653)
at javax.crypto.Cipher.getInstance(Cipher.java:596)
答案 0 :(得分:0)
我相信任何JCE提供程序JAR必须先签名才能被Java运行时信任。看来你所拥有的jar中有无内容的内容。
如果这是您添加到jar或您制作的jar中的内容,请查看此答案,告诉您如何签名:How to sign a custom JCE security provider