簡體   English   中英

簽名簽名的Axis2 / rampart加密問題

[英]Axis2/rampart cryptography problem with signaturePropFile

我對必須使用WS-Security的WebService客戶端有問題。 我的客戶是用axis2編寫的。 當我不啟用加密功能時(我的服務器仿真器當然),它可以工作。 我通過添加到axis.xml來啟用加密:

<!--Signature and Encryption : Using the request's certificate-->
<module ref="rampart" />

<parameter name="OutflowSecurity">
  <action>
    <items>Signature</items>
    <user>mn</user>
      <passwordCallbackClass>PWCallback</passwordCallbackClass>
      <signaturePropFile>client.properties</signaturePropFile>
    <signatureKeyIdentifier>SKIKeyIdentifier</signatureKeyIdentifier>
    <signatureParts>{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body</signatureParts>
  </action>
</parameter> 

現在,當我使用參數從Eclipse調用客戶端時:

-Daxis2.xml=axis-repo/conf/axis2.xml -Daxis2.repo=axis-repo

我有:

org.apache.axis2.AxisFault: CryptoFactory: Cannot load properties: client.properties
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:67)
at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72)
at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
...
Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load properties: client.properties
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:258)
at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:171)
at org.apache.ws.security.handler.WSHandler.loadSignatureCrypto(WSHandler.java:431)
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:137)
at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:201)
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:64)
... 9 more
Caused by: java.lang.NullPointerException
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:253)
... 14 more

我可以將client.properties作為File對象打開。 我試圖將此文件放在各個目錄中,或將其名稱更改為使用完整路徑(在Windows上工作時都使用斜杠和反斜杠),但沒有任何幫助。

我的client.properties文件如下所示:

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=mn
org.apache.ws.security.crypto.merlin.file=mn_keystore.ks

知道為什么我會收到此錯誤嗎?

我發現我必須將client.propertiesmn_keystore.ks添加到wss4j-1.5.8.jar 我不知道這是否是設計使然。 我的喜好是將兩個文件都移出該.jar庫。

編輯 :在其他環境下,我嘗試使用單獨的client.properties ,它起作用了! 現在, wss4j-1.5.8.jar是原始版本,沒有配置和密鑰庫。 我不知道為什么要這樣,而且較早不起作用:(

EDIT2 :當Eclipse運行應用程序時,它可能不會將項目目錄添加到claaspath。 我辭職了,沒有將.properies文件添加到一些.jar中,現在我使用:從菜單中選擇“運行”->“調試配置”,找到您的Java應用程序及其“類路徑”選項卡。 然后選擇“用戶條目”,然后從右側面板中單擊“高級”按鈕,然后選擇“添加外部文件夾”。 現在添加帶有.properties文件的目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM