1、首先我向大家介绍一下我做的东西,发生这个异常的情况。

  我做的是一个电签的系统,在调用某公司的API生成证书,然后与安证通进行同步证书的任务。

2、问题具体的异常

  具体异常如下:

2016/08/29 15:19:25 : INFO [com.bjazt.easysign.server.SyncServiceImpl] 进入同步接口:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ROWDATA>
<ROW xsi:type="aztCert" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CERTID>SYNC110101198912129995</CERTID>
<USERID>110101198912129995</USERID>
<OPTYPE>A</OPTYPE>
<PASSWORD>itrusyes</PASSWORD>
<PFX>MIIM9wYJKoZIhvcNAQcCoIIM6DCCDOQCAQExADALBgkqhkiG9w0BBwGgggzMMIIDwzCCAqugAwIBAgIUYfdQUqQxBCEGlELPLH3RBkuei9UwDQYJKoZIhvcNAQEFBQAwaTEjMCEGA1UEAwwa5aSp5aiB6K+a5L+hUlNB5rWL6K+V5qC5Q0ExEjAQBgNVBAsMCVJTQea1i+ivlTEhMB8GA1UECgwY5aSp5aiB6K+a5L+h5rWL6K+V57O757ufMQswCQYDVQQGEwJDTjAeFw0xNjA1MDcxMTQxMzhaFw0zNjA1MDIxMTQxMzhaMGkxIzAhBgNVBAMMGuWkqeWogeivmuS/oVJTQea1i+ivleaguUNBMRIwEAYDVQQLDAlSU0HmtYvor5UxITAfBgNVBAoMGOWkqeWogeivmuS/oea1i+ivleezu+e7nzELMAkGA1UEBhMCQ04wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ48CCSv2qk3hBSKIdkCilUZDK9KUi2XHpq3xcndUWREesGhEQunqjC6gTX9KV9jW+h++GqM2t8S3lIrED86BmfNkGniwS2lw3LCY+zTsGRrpVN7U7barcs3LC/N0mWgRmYxQmqn8bvinmacxu1mS6x6QVkwbYHHJKcjIuTObefCGLmcQP5NTO2MJHNK5892o7EE1SE4iEVR6SydN8q2/+LA7TVgIRZi/aZufhbXwH45Ga1oVnRc/8i8b4iOa6n1vM5j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CoECGPlBvcnQvVG9wQ0EvcHVibGljL2l0cnVzY3JsP0NBPTMxZjcxY2NiOGVlOTZiZGRlYTAzMDQyMTkzYTlkMDEzMA0GCSqGSIb3DQEBBQUAA4IBAQDSeEgUBQJFIjIUvAK9lwcNUNBSjbdrhkHBK0jkaQxO7Hbxz78Roa9mzoUIZaOLsBFxYij30Y9TUfUNVI4lCLf11azOD4+qQo+Z3iHNnGKDZpB3rhtLFkyREE48kXwASyFvlb5wXGw6pl6QOVSarxvw0JzAIHOkCIVmXkWn6EjkF4S2xF+lpETJx9V6MCib9qdvhFy3izAqRN6ieGypuXzpSmgjilDzBtzpDqZq9GnyJdfIOP7Ij2xCT1vf5gjs/HTp2Xr26BERaS8+dU8iqkbLLClFh7zwztbRghmki06eoVOI3NvOF4QdgNouFD8hyIAACNdzc/F6RMyKgRX9tJu6MQA=</PFX>
</ROW>
</ROWDATA> 2016/08/29 15:19:25 : INFO [com.bjazt.easysign.server.SyncServiceImpl] 将XML转为Bean,开始
java.io.IOException: DER input, Integer tag error
at sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1202)
at java.security.KeyStore.load(KeyStore.java:1185)
at com.esa2000.datasync.common.SystemUtil.validateCertificate(SystemUtil.java:483)
at com.esa2000.datasync.document.XmlToPfxCert.toObject(XmlToPfxCert.java:45)
at com.esa2000.datasync.document.XmlToBean.toObjectList(XmlToBean.java:31)
at com.esa2000.datasync.document.XmlToBean.toObject(XmlToBean.java:47)
at com.bjazt.easysign.server.SyncServiceImpl.sync(SyncServiceImpl.java:26)
at com.bjazt.easysign.server.SyncServiceImpl.syncPfxCert(SyncServiceImpl.java:50)
at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
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:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
2016/08/29 15:19:25 : ERROR [com.esa2000.datasync.document.XmlToPfxCert]
java.io.IOException: DER input, Integer tag error
at sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1202)
at java.security.KeyStore.load(KeyStore.java:1185)
at com.esa2000.datasync.common.SystemUtil.validateCertificate(SystemUtil.java:483)
at com.esa2000.datasync.document.XmlToPfxCert.toObject(XmlToPfxCert.java:45)
at com.esa2000.datasync.document.XmlToBean.toObjectList(XmlToBean.java:31)
at com.esa2000.datasync.document.XmlToBean.toObject(XmlToBean.java:47)
at com.bjazt.easysign.server.SyncServiceImpl.sync(SyncServiceImpl.java:26)
at com.bjazt.easysign.server.SyncServiceImpl.syncPfxCert(SyncServiceImpl.java:50)
at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
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:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

 3、解决问题

  错误的原因是证书的申请是pkcs7格式的生成,但是安证通同步解析用到的是pkcs12,造成编码解码不一致的问题。

  起初就是jar包的冲突问题,bcprov-jdk15-1.46.jar没有向下兼容bcprov-jdk15-1.43.jar,因为这其中的DERSequence方法的构造方法不同。大家可以自行的下载看看。

  最后我们是在申请证书之后,用证书去获取这个pfx格式的编码,然后去用安证通同步,这样就解决了这个问题。(因为这是第三方的东西,所以要和第三方进行沟通,他们提供了一个新的方法来获取证书的pfx格式编码)。

  4、总结

  遇见jar包冲突的问题,解决的根本方法就是去掉冲突的jar,留下一个我们用到的jar包,否则,就算解决了,项目上线也会有很多的问题的。

  5、美诗美句

  少年不识愁滋味,爱上层楼,爱上层楼,为赋新词强说愁。

  而今识尽愁滋味,欲说还秀,欲说还休,却道天凉好个秋。

  

DER input, Integer tag error的异常处理的更多相关文章

  1. 支付宝APP支付开发- IOException : DER input, Integer tag error

    支付宝APP支付Java开发报错: 1 java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: I ...

  2. input textbox tag

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb8AAAB0CAIAAACaKavmAAAJ0klEQVR4nO3dO2wb5wHA8YOHIkOLrk

  3. <input type="file"> change事件异常处理办法

    问题:最近发现一个奇怪的bug, 那就是在上传图片需要采用input type=file来进行文件选择.由于为了适应美工的UI图,所以是把选择文件的input框隐藏了.然后通过另外一个按钮的点击事件来 ...

  4. 前后端java+vue 实现rsa 加解密与摘要签名算法

    RSA 加密.解密.签名.验签.摘要,前后端java+vue联调测试通过 直接上代码 // 注意:加密密文与签名都是唯一的,不会变化.// 注意:vue 端密钥都要带pem格式.java 不要带pem ...

  5. springMVC整理04--文件上传 & 拦截器 & 异常处理

    1.  文件上传 SpringMVC 的文件上传非常简便,首先导入文件上传依赖的 jar: <!-- 文件上传所依赖的 jar 包 --> <dependency> <g ...

  6. Python异常和异常处理

    Python异常和异常处理2017年12月20日 22:17:08 Megustas_JJC 阅读数:114 标签: python 异常处理 更多 个人分类: Python 版权声明:本文为博主原创文 ...

  7. Java中的异常处理try catch(第八周课堂示例总结)

    异常处理 使用Java异常处理机制: 把可能会发生错误的代码放进try语句块中. 当程序检测到出现了一个错误时会抛出一个异常对象. 异常处理代码会捕获并处理这个错误. catch语句块中的代码用于处理 ...

  8. python异常处理(基础)

    之前在学习python的时候有整理过python异常处理的文章,不够简单也不够完整,所以决定再整理一篇,算做补充. http://www.cnblogs.com/fnng/archive/2013/0 ...

  9. 结对编程之Fault、Error、Failure

    1.结对说明 结对对象:刘世麟  博客地址:http://www.cnblogs.com/liushilin/ 双方贡献:1:1 2.题目要求  构造程序,分别是:         •不能触发Faul ...

随机推荐

  1. B树(B-Tree)的由来、数据结构、基本操作以及数据库索引的应用

    B树是为磁盘存储而专门设计的一类平衡搜索树,B树的高度仅随着它所包含的节点数按对数增长,不过因为单个节点可以包含多个关键字,所以对数的底数可以比较大,实际应用中一般是50~2000,给个直观的数字,一 ...

  2. 安装SQL SERVER 2005出现“sql2005 执行安装向导期间出错 ”

    安装sql server 2005时出现“sql2005 执行安装向导期间出错”的提示,百度找了一下,发现原来是解压时候才安装了CD1的,还有CD2的没解压安装,解压CD2安装即可

  3. tensorflow添加自定义的auc计算operator

    tensorflow可以很方便的添加用户自定义的operator(如果不添加也可以采用sklearn的auc计算函数或者自己写一个 但是会在python执行,这里希望在graph中也就是c++端执行这 ...

  4. codeigniter框架The URI you submitted has disallowed characters错误解决方法

    CI中URI传递参数时,出现:The URI you submitted has disallowed characters.错误 .原因:这是由于uri中存在CI不允许的字符 . 解决办法:在con ...

  5. OGG-01820 Could not enable workspace

    状况: OGG replicat进程abend了,查看report显示如下问题: 2016-11-01 16:11:47  ERROR   OGG-01820  Could not enable wo ...

  6. [C++][数据结构]栈(stack)的实现

    对于栈的定义,前人之述备矣. 我实现的是一个stack<value>容器类,支持push,pop,top,size,empty,clear和copy construction操作. 主要的 ...

  7. PHP运行模式

    1.运行模式 关于PHP目前比较常见的五大运行模式: 1)CGI(通用网关接口 / Common Gateway Interface) 2)FastCGI(常驻型CGI / Long-Live CGI ...

  8. for循环中i--的妙用 及 两变量互换数值的问题

    int[] array = new int[4]; for(int i = 0; i < array.length; i++){ array[i] = (int)(Math.random() * ...

  9. postcss-px2rem

    1.安装 npm install gulp-postcss --save-dev 2.gulp var gulp = require('gulp'); var postcss = require('g ...

  10. jqgrid cellEdit为true的时候,默认选中单元格值的解决方案

    jqgrid cellEdit为true的时候,点击单元格的时候,鼠标在单元格最前面闪. 这时候如果要修改数字内容,非常麻烦.要全选单元格内容,不然不好改. 点击单元格的时候,默认选中单元格值的解决方 ...