使用加密签名时遇到的一个问题

使用加密签名时遇到的一个问题:

com.koalii.svs.SecretStoreException: load pfx file /*.pfx - java.io.IOException: exception unwrapping private key - java.security.InvalidKeyException: Illegal key size
	at com.koalii.svs.PfxStore.setCertAndKey(PfxStore.java:67)
	at com.koalii.svs.PfxStore.<init>(PfxStore.java:27)
	at com.koalii.svs.SvsSign.initSignCertAndKey(SvsSign.java:90)
	at com.yuantu.virtual.viraccount.util.SignUtils.signForString(SignUtils.java:146)
	at com.yuantu.virtual.viraccount.util.XmlUtils.transToXML(XmlUtils.java:78)
	at com.yuantu.virtual.viraccount.manager.VirAccountManager.consumeMsg(VirAccountManager.java:661)
	at com.yuantu.virtual.viraccount.manager.VirAccountManager$$FastClassByCGLIB$$efe69d8.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
	at com.yuantu.common.profiler.ProfilerApsect.invoke(ProfilerApsect.java:36)
	at sun.reflect.GeneratedMethodAccessor293.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
	at com.*.virtual.viraccount.manager.VirAccountManager$$EnhancerByCGLIB$$a5a974d6.consumeMsg(<generated>)
	at com.*.virtual.viraccount.mq.VirAccountMessageListener.consumeMessage(VirAccountMessageListener.java:42)
	at com.alibaba.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService$ConsumeRequest.run(ConsumeMessageConcurrentlyService.java:413)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

处理办法: 在官方网站下载JCE无限制权限策略文件
JDK7的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK8的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 
下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt
如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件
如果安装了JDK,还要将两个jar文件也放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件

参考:http://www.cnblogs.com/gdayq/p/5919252.html

 

转载于:https://my.oschina.net/mengzhang6/blog/1790991

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值