为了简短起见,我的问题如下:
我在函数的开头添加了 BC-Provider:
Security.addProvider(new BouncyCastleProvider());
当我列出所有服务时
BouncyCastleProvider().getServices();
该列表包含“RIPEMD160WITHECDSA”
在此代码段的最后一行:
XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
DOMValidateContext valContext = new DOMValidateContext(pubkeys[i], sigElement);
valContext.setURIDereferencer(new FileDereferencer(
factory.getURIDereferencer(), new File("D:\\eclipseworkspace\\pathtoxml.xml")));
javax.xml.crypto.dsig.XMLSignature xmlSignature = factory.unmarshalXMLSignature(valContext);
我收到一条消息异常:
不支持的 SignatureMethod 算法:http ://www.w3.org/2007/05/xmldsig-more#ecdsa-ripemd160
这意味着什么?RIPEMD160WITHECDSA 与此 URL 指定的算法有什么区别?或者 url 只是没有映射到这个算法名?
这是堆栈跟踪:
javax.xml.crypto.MarshalException: unsupported SignatureMethod algorithm: http://www.w3.org/2007/05/xmldsig-more#ecdsa-ripemd160
at org.jcp.xml.dsig.internal.dom.DOMSignatureMethod.unmarshal(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMSignedInfo.<init>(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.<init>(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory.unmarshal(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory.unmarshalXMLSignature(Unknown Source)
at com.mobile.xmlsignature.XMLSigChecker.verify(XMLSigChecker.java:122)
at com.mobile.xmlsignature.mainclass.main(mainclass.java:13)