BouncyCastle创建密码时出现异常

时间:2014-09-05 12:36:40

标签: java bouncycastle pgp

我正在尝试在我的tomcat上本地运行一个项目,但是我从BouncyCastle获得了一个Exception。

我已经检查了密钥的路径和密钥名称,都是正确的。我还交换了jce策略文件。然而问题仍然存在。还有其他建议吗?

以下是完整的例外情况:

org.bouncycastle.openpgp.PGPException: Exception creating cipher
        at org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(Unknown Source)
        at org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(Unknown Source)
        at com.bfs.pgp.Encrypt.encrypt(Encrypt.java:206)
        at com.bfs.pgp.Encrypt.getEncryptedString(Encrypt.java:105)
        at org.apache.jsp.webapps.xxx.pages.xxx.XXXStart_jsp.getCryptedValue(XXXStart_jsp.java:26)
        at org.apache.jsp.webapps.xxx.pages.xxx.XXXStart_jsp._jspService(XXXStart_jsp.java:158)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.bouncycastle.openpgp.PGPException: cannot create cipher: No such algorithm: IDEA/OpenPGPCFB/NoPadding
        at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createCipher(Unknown Source)
        at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createStreamCipher(Unknown Source)
        at org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder$MyPGPDataEncryptor.<init>(Unknown Source)
        at org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder.build(Unknown Source)
        ... 24 more
Caused by: java.security.NoSuchAlgorithmException: No such algorithm: IDEA/OpenPGPCFB/NoPadding
        at javax.crypto.Cipher.getInstance(Cipher.java:673)
        at javax.crypto.Cipher.getInstance(Cipher.java:580)
        at org.bouncycastle.jcajce.NamedJcaJceHelper.createCipher(Unknown Source)
        ... 28 more
java.lang.NullPointerException
        at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:106)
        at sun.misc.CharacterEncoder.encode(CharacterEncoder.java:188)
        at com.bfs.pgp.Encrypt.getEncryptString(Encrypt.java:237)
        at com.bfs.pgp.Encrypt.getEncryptedString(Encrypt.java:106)
        at org.apache.jsp.webapps.xxxPayment.pages.xxxx.XXXStart_jsp.getCryptedValue(XXXStart_jsp.java:26)
        at org.apache.jsp.webapps.xxxPayment.pages.xxxx.XXXStart_jsp._jspService(XXXStart_jsp.java:158)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:722)

0 个答案:

没有答案