A problem encountered when using cryptographic signatures

A problem encountered when using cryptographic signatures:

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)

Solution: Download the JCE Unrestricted Privilege Policy File
JDK7 from the official website: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
Download JDK8: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 
After downloading and unzipping, you can see local_policy.jar and US_export_policy.jar and readme.txt
If JRE is installed, the two Put the jar files in the %JRE_HOME%\lib\security directory to overwrite the original files.
If JDK is installed, put the two jar files in the %JDK_HOME%\jre\lib\security directory to overwrite the original files.

Reference: http://www.cnblogs.com/gdayq/p/5919252.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325283004&siteId=291194637