当前位置:  开发笔记 > 编程语言 > 正文

wss4j: - 找不到别名的密钥:monit

如何解决《wss4j:-找不到别名的密钥:monit》经验,为你挑选了1个好方法。

当我在client-config.wsdd中为WSDoAllSender和WSDoAllReceiver定义(使用轴1.4和wss4j)时,我有不同的signaturePropFiles,其中我有不同的密钥库,用不同的证书定义,我可以有不同的发送和接收证书.但是当我使用相同的keyPropFiles'时,我使用相同的密钥库.我尝试发送消息时收到此消息:

  org.apache.ws.security.components.crypto.CryptoBase -- Cannot find key for alias: [monit] in keystore of type [jks] from provider [SUN version 1.5] with size [2] and aliases: {other, monit}
- Error during Signature: ; nested exception is:
        org.apache.ws.security.WSSecurityException: Signature creation failed; nested exception is:
        java.lang.Exception: Cannot find key for alias: [monit]
org.apache.ws.security.WSSecurityException: Error during Signature: ; nested exception is:
        org.apache.ws.security.WSSecurityException: Signature creation failed; nested exception is:
        java.lang.Exception: Cannot find key for alias: [monit]
        at org.apache.ws.security.action.SignatureAction.execute(SignatureAction.java:60)
        at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:202)
        at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:168)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at cz.xxx.opf.model.wsclient.ModelWebServiceSoapBindingStub.getStatus(ModelWebServiceSoapBindingStub.java:213)
        at cz.xxx.opf.wsgemonitor.monitor.util.MonitorUtil.checkStatus(MonitorUtil.java:18)
        at cz.xxx.opf.wsgemonitor.monitor.Test02WsMonitor.runTest(Test02WsMonitor.java:23)
        at cz.xxx.opf.wsgemonitor.Main.main(Main.java:75)
Caused by: org.apache.ws.security.WSSecurityException: Signature creation failed; nested exception is:
        java.lang.Exception: Cannot find key for alias: [monit]
        at org.apache.ws.security.message.WSSecSignature.computeSignature(WSSecSignature.java:721)
        at org.apache.ws.security.message.WSSecSignature.build(WSSecSignature.java:780)
        at org.apache.ws.security.action.SignatureAction.execute(SignatureAction.java:57)
        ... 15 more
Caused by: java.lang.Exception: Cannot find key for alias: [monit]
        at org.apache.ws.security.components.crypto.CryptoBase.getPrivateKey(CryptoBase.java:214)
        at org.apache.ws.security.message.WSSecSignature.computeSignature(WSSecSignature.java:713)
        ... 17 more

如何在同一个密钥库中为wss4j提供两个证书?当我在一个密钥库中有两个证书时,为什么它找不到我的证书.

关于PWCallback(CallbackHandler)的两个证书都有相同的密码

我的属性文件:

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin 
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keystore
org.apache.ws.security.crypto.merlin.keystore.alias=monit
org.apache.ws.security.crypto.merlin.alias.password=***
org.apache.ws.security.crypto.merlin.file=key.jks

我的client-config.wsdd:

  
   
  
   
        
        
        
        
        
        
   
     
        
     
     
        
        
     
   
     
        
              
            
            
            
              
          
   

 

   

 

从keytool列出:keytool -keystore monit-key.jks -v -list

Enter keystore password:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 2 entries

Alias name: other
Creation date: Jul 22, 2009
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
....

Alias name: monit
Creation date: Oct 19, 2009
Entry type: trustedCertEntry

feiroox.. 6

几个月前我解决了,如果有人需要的话.问题是我在密钥库中没有私钥.



1> feiroox..:

几个月前我解决了,如果有人需要的话.问题是我在密钥库中没有私钥.

推荐阅读
地之南_816
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有