2014-01-29 21 views
0

我正在用一點WS-Security(XML Signature)編寫一個簡單的CXF客戶端和服務器。到現在爲止還挺好。CXF/XML簽名:如何更改規範化算法?

... 
outProps.put("signatureParts", 
      "{Element}{" + WSU_NS + "}Timestamp;" 
      + "{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body;" 
      + "{}{http://www.w3.org/2005/08/addressing}ReplyTo;"); 
outProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1"); 
... 
client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps)); 

我想改變的是規範化算法EXCLUSIVE(C14N_EXCL_OMIT_COMMENTS又名 「http://www.w3.org/2001/10/xml-exc-c14n#」)。

回答

0

CXF中的默認值已爲「http://www.w3.org/2001/10/xml-exc-c14n#」。

可以通過配置標籤「signatureC14nAlgorithm」(從WSS4J 1.6.12起)更改簽名c14n算法。

參見:http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/handler/WSHandlerConstants.java?r1=1507331&r2=1513780

+0

怎麼能一組 「signatureC14nAlgorithm」 在JBoss中7?我寫了一個web服務提供者並使用註解:「@EndpointProperty(key =」signatureC14nAlgorithm「,value =」http://www.w3.org/TR/2001/REC-xml-c14n-20010315「)」 - 但是jboss忽略了annoation。 –