我正在尝试使用SOAP客户端进行电子归档应用程序。提供了SOAP客户端的文档here。
当我尝试运行客户端时,我收到以下错误:
18:21:09,441 [ERROR] [org.apache.wss4j.dom.message.WSSecSignature] [main] [computeSignature] [584] - [Cannot find key for alias: [<MY-ALIAS-NAME>]]
org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
at org.apache.wss4j.common.crypto.Merlin.getPrivateKey(Merlin.java:745)
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:528)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignature(AsymmetricBindingHandler.java:691)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:176)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.handleBinding(AsymmetricBindingHandler.java:110)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessageInternal(PolicyBasedWSS4JOutInterceptor.java:201)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:114)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:101)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
at com.sun.proxy.$Proxy35.uploadBulkPan(Unknown Source)
at bulkPanService.BulkPanService_Client.main(BulkPanService_Client.java:34)
18:21:09,447 [WARN] [org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler] [main] [doSignBeforeEncrypt] [231] - [Sign before encryption failed due to : Cannot find key for alias: [<MY-ALIAS-NAME>]]
18:21:09,449 [WARN] [org.apache.cxf.common.logging.LogUtils] [main] [doLog] [452] - [Interceptor for {http://incometaxindiaefiling.gov.in/ditsecws}BulkPanService#{http://incometaxindiaefiling.gov.in/ditsecws}uploadBulkPan has thrown exception, unwinding now]
org.apache.cxf.interceptor.Fault: Cannot find key for alias: [<MY-ALIAS-NAME>]
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:233)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.handleBinding(AsymmetricBindingHandler.java:110)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessageInternal(PolicyBasedWSS4JOutInterceptor.java:201)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:114)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:101)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
at com.sun.proxy.$Proxy35.uploadBulkPan(Unknown Source)
at bulkPanService.BulkPanService_Client.main(BulkPanService_Client.java:34)
Caused by: org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
Original Exception was org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:585)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignature(AsymmetricBindingHandler.java:691)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:176)
... 13 more
Caused by: org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
at org.apache.wss4j.common.crypto.Merlin.getPrivateKey(Merlin.java:745)
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:528)
... 15 more
Invocation failed with the following: org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
Original Exception was org.apache.wss4j.common.ext.WSSecurityException: Cannot find key for alias: [<MY-ALIAS-NAME>]
在属性文件中,我提供
org.apache.ws.security.crypto.provider=org.apache.wss4j.common.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=12345678
org.apache.ws.security.crypto.merlin.keystore.private.password=12345678
org.apache.ws.security.crypto.merlin.keystore.alias=MY-ALIAS-NAME
org.apache.ws.security.crypto.merlin.keystore.file=keystore/client/me.jks
我使用命令
从.jks
文件生成了.cer
文件
keytool -importcert -file PRIVATE_KEY.cer -keystore me.jks -alias MY-ALIAS-NAME
有人知道如何解决这个错误吗?