在SignInfo节点中我有
<ds:Reference URI="#Id-132">...
它指的是以下节点:
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-132">
命令:
xmlsec1 --sign --output request-signed.xml --privkey-pem privatekey.pem raw_message.xml
我有这个错误: func = xmlSecXPathDataExecute:file = xpath.c:line = 273:obj = unknown:subj = xmlXPtrEval:error = 5:libxml2库函数失败:expr = xpointer(id('Id-132'))
答案 0 :(得分:0)
要使用id签名,必须使用--id-attr:
参数。示例:
<ds:Reference URI="#Id-132">
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-132">
命令:xmlsec1 --sign --output request-signed.xml --privkey-pem privatekey.pem --id-attr:Id raw_message.xml
更多信息:https://snippets.aktagon.com/snippets/758-how-to-sign-xml-documents-using-xmldsig-xml-signature-