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

就我碰到的,中文问题主要是2个:
1) 传出的字符乱码
2) 出现如下异常:
[quote]org.apache.ws.security.WSSecurityException: The signature or decryption was invalid; nested exception is:
org.apache.xml.security.encryption.XMLEncryptionException: [color=red]An invalid XML character (Unicode: 0x10) was found in the element content of the document.[/color]
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)[/quote]
升级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的一个问题有关:
[quote]Xml canonization - UTF-8 encoding issue in Xml security 1.4.0.
Committed by RB. Thanks to Karol Rewera. See Issue [url=http://issues.apache.org/bugzilla/show_bug.cgi?id=41462]41462[/url][/quote]
该问题在xmlsec-1.4.1中解决。

Apache XML Security History of Changes:
[url=http://santuario.apache.org/changes.html]http://santuario.apache.org/changes.html[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值