1

在 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 library function failed:expr=xpointer(id('Id-132'))

4

1 回答 1

0

使用 ids 引用签名是必要的--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-

于 2018-11-19T21:23:29.117 回答