如何为我的xml正文生成正确的DigestValue?

时间:2017-04-20 19:09:12

标签: xml digital-signature canonicalization

据我所知,我应该通过获取标记的URI属性所指向的XML元素的规范形式来获取DigestValue,对其执行sha1哈希,而不是基本64编码它

这是参考开始标记: <ds:Reference URI="#id-8199334E5D75D0579B149267885542664"> 所以我认为它指向了这个元素:

<soapenv:Body wsu:Id="id-8199334E5D75D0579B149267885542664" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity- utility-1.0.xsd">
      <ns:WTR_ReadRecordRQ Version="0.1">
         <ns:POS>
            <ns1:Source AirlineVendorID="MM"/>
         </ns:POS>
         <ns:RecordID>
            <ns2:RecordType>DELAYED</ns2:RecordType>
            <ns2:RecordReference AirlineCode="MM" ReferenceNumber="10703" 
             StationCode="ATL"/>
         </ns:RecordID>
         <ns:AgentID>RFFTEGRNT</ns:AgentID>
      </ns:WTR_ReadRecordRQ>    
</soapenv:Body>

假设获取的摘要值是这个:

<ds:DigestValue>WiMBTNpMAdsACap6eUn7O1IYXG4=</ds:DigestValue>

但无论我做什么我都会得到一个不同的DigestValue

我需要做什么才能成功正确生成它?! 我真的需要帮助!!

0 个答案:

没有答案