当我使用 wss4j 在soap 标头中签署X509 时存在异常。我的代码在这里:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Document document = msg.getSOAPPart().getEnvelope().getOwnerDocument();
Crypto crypto = CryptoFactory.getInstance();
WSSecSignature signature = new WSSecSignature();
WSSecHeader secuHeader = new WSSecHeader("",false);
secuHeader.insertSecurityHeader(document);
String user = "16c73ab6-b892-458f-abf5-2f875f74882e";
String password ="security";
signature.setUserInfo(user, password);
signature.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
signature.build(document, crypto, secuHeader);
我只是在 wss4j 中使用默认的 crypto.properties。但是,存在一个例外:
Exception in thread "main" java.lang.AssertionError: UNIMPLEMENTED
at weblogic.xml.domimpl.ElementBase.setIdAttributeNS(ElementBase.java:327)
at org.jcp.xml.dsig.internal.dom.DOMUtils.setAttributeID(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMKeyInfo.marshal(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMKeyInfo.marshal(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
at org.apache.ws.security.message.WSSecSignature.computeSignature(WSSecSignature.java:554)
at org.apache.ws.security.message.WSSecSignature.computeSignature(WSSecSignature.java:479)
at org.apache.ws.security.message.WSSecSignature.build(WSSecSignature.java:385)
我想知道如何解决这个异常。谢谢你的帮助!