`
alone11
  • 浏览: 57415 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

WS-Security: axis, cxf使用wss4j的中文处理问题

    博客分类:
  • Java
阅读更多
就我碰到的,中文问题主要是2个:
1) 传出的字符乱码
2) 出现如下异常:
引用
org.apache.ws.security.WSSecurityException: The signature or decryption was invalid; nested exception is:
org.apache.xml.security.encryption.XMLEncryptionException: An invalid XML character (Unicode: 0x10) was found in the element content of the document.
Original Exception was org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x10) was found in the element content of the document.
at org.apache.ws.security.processor.EncryptedKeyProcessor.decryptDataRef(EncryptedKeyProcessor.java:431)
at org.apache.ws.security.processor.EncryptedKeyProcessor.handleEncryptedKey(EncryptedKeyProcessor.java:342)
at org.apache.ws.security.processor.EncryptedKeyProcessor.handleEncryptedKey(EncryptedKeyProcessor.java:92)
at org.apache.ws.security.processor.EncryptedKeyProcessor.handleToken(EncryptedKeyProcessor.java:80)
at org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurityEngine.java:311)

升级wss4j到1.5.5可解决问题,主要有2个jar包需要替换:以1.5.4到1.5.5为例
1) wss4j-1.5.4.jar -> wss4j-1.5.5.jar
2) xmlsec-1.4.0.jar -> xmlsec-1.4.2.jar

中文处理问题可能与xmlsec-1.4.0的一个问题有关:
引用
Xml canonization - UTF-8 encoding issue in Xml security 1.4.0.
       Committed by RB. Thanks to Karol Rewera. See Issue 41462

该问题在xmlsec-1.4.1中解决。

Apache XML Security History of Changes:
http://santuario.apache.org/changes.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics