1:报错如下
Exception in thread "main" java.io.IOException: DerInputStream.getLength(): lengthTag=111, too big.at sun.security.util.DerInputStream.getLength(DerInputStream.java:599)at sun.security.util.DerValue.init(DerValue.java:391)at sun.security.util.DerValue.<init>(DerValue.java:332)at sun.security.util.DerValue.<init>(DerValue.java:345)at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1938)at java.security.KeyStore.load(KeyStore.java:1445)at com.wn.cloud.finance.manager.SHA256WithRSATest.parseP12(SHA256WithRSATest.java:107)at com.wn.cloud.finance.manager.SHA256WithRSATest.sign(SHA256WithRSATest.java:62)at com.wn.cloud.finance.manager.SHA256WithRSATest.main(SHA256WithRSATest.java:41)
Disconnected from the target VM, address: '127.0.0.1:50815', transport: 'socket'
2:解决方法
这个插件的作用是在maven编译打包项目的时候忽略指定后缀的文件,秘钥如果不忽略就会被编译,编译后就会出问题
maven对它支持的几种类型外在编译的时候会对其他文件改写里面的内容
在pom文件中<plugins></plugins>中加入以下配置就OK
<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><configuration><encoding>UTF-8</encoding><!-- 过滤后缀为pem、pfx的证书文件 --><nonFilteredFileExtensions><nonFilteredFileExtension>p12</nonFilteredFileExtension><nonFilteredFileExtension>cer</nonFilteredFileExtension><nonFilteredFileExtension>pem</nonFilteredFileExtension><nonFilteredFileExtension>pfx</nonFilteredFileExtension></nonFilteredFileExtensions></configuration></plugin></plugins>