Mình đang viết 1 tool ký nội dung. Tìm hiểu lâu mà chưa có hướng làm.

Vấn đề của mình là ký 1 nội dung nào đó mà đầu ra nó tương tự như sau:

XML Code:
  1. <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
  2.         <ds:SignedInfo>
  3.             <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
  4.             <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
  5.             <ds:Reference URI="cid:0">
  6.                 <ds:Transforms>
  7.                     <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
  8.                     <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
  9.                     <ds:XPath>not(ancestor-or-self::node()[@soap-env:actor="urn:oasis:names:tc:edxml-msg:actor:nextMSH"] |
  10.                     ancestor-or-self::node()[@soap-env:actor="http://schemas.xmlsoap.org/soap/actor/next"])</ds:XPath>
  11.                     </ds:Transform>
  12.                     <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
  13.                 </ds:Transforms>
  14.                 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
  15.                 <ds:DigestValue>NLzZ5KNIf1iTW8Fdkn0or/0wDJc=</ds:DigestValue>
  16.             </ds:Reference>
  17.             <ds:Reference URI="cid:0">
  18.                 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
  19.                 <ds:DigestValue>c+YUJufy39UnOTp/GeMKPmr5a0o=</ds:DigestValue>
  20.             </ds:Reference>
  21.         </ds:SignedInfo>
  22.         <ds:SignatureValue>
  23.             IuRNgCiyZH4/eifWi5sRehpjkZDfJUcyJTwiIF7NQslO29fMfDkZNRaHgHwStiSV1DTWOZbJbC8E
  24.             6jcidx2L1AONUg1fjIHFd/IZ1JGuGentQpdVEfv5VhCEh/IUWYmBTMrky9qAPJ/hCorAv9kPJY3A
  25.             vnlKQm2rXH9OqklLJfI=
  26.         </ds:SignatureValue>
  27.         <ds:KeyInfo>
  28.             <ds:X509Data>
  29.                 <ds:X509Certificate>
  30.                     MIICnjCCAgegAwIBAgIBAzANBgkqhkiG9w0BAQQFADB+MQswCQYDVQQGEwJISzESMBAGA1UECBMJ
  31.                     SG9uZyBLb25nMRIwEAYDVQQHEwlIb25nIEtvbmcxDjAMBgNVBAoTBUNFQ0lEMSQwIgYDVQQLExtU
  32.                     aGUgVW5pdmVyc2l0eSBvZiBIb25nIEtvbmcxETAPBgNVBAMTCENFQ0lEIENBMB4XDTAzMDkxOTAz
  33.                     NDkxMVoXDTEzMDkxNjAzNDkxMVowgYkxCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcx
  34.                     EjAQBgNVBAcTCUhvbmcgS29uZzEOMAwGA1UEChMFQ0VDSUQxJDAiBgNVBAsTG1RoZSBVbml2ZXJz
  35.                     aXR5IG9mIEhvbmcgS29uZzEcMBoGA1UEAxMTQ0VDSUQgWE1MIFNpZ25hdHVyZTCBnzANBgkqhkiG
  36.                     9w0BAQEFAAOBjQAwgYkCgYEAqPRszoyHH79W5rW3ZoIGomu21IAL5RYmxO86NJy+7oNlxQNt7FlL
  37.                     lzs7R97NkTMbqcUWSUiPYR0OlsRQqf54YypKpLK8+eE4qHwG8Rhr4JnCw9XB5wNS8/aPPpW2mkZz
  38.                     tJiPfUKekYi+IL9EuVsn3aA2+OvbeVYfToJ9BHBIptsCAwEAAaMgMB4wDAYDVR0TAQH/BAIwADAO
  39.                     BgNVHQ8BAf8EBAMCBsAwDQYJKoZIhvcNAQEEBQADgYEAsUgBEdnF5jZEidjslVEyXEbe58KipDAs
  40.                     /Gf4LWawieLuSWj9haqIj+VR3PdqUI8YpmW2XiM0xNf0Fy0K2oaAZKVOwtRSUlefxdj9YL1PpHxk
  41.                     AZj6OgPo0AeTqdsmmUi9FgZclrmB0PrbLFN1fWDBElD0bzMv4hSOflatSdr5cTQ=
  42.                 </ds:X509Certificate>
  43.             </ds:X509Data>
  44.         <ds:X509Data>
  45.             <ds:X509Certificate>
  46.                     MIIClTCCAf6gAwIBAgIBADANBgkqhkiG9w0BAQQFADB+MQswCQYDVQQGEwJISzESMBAGA1UECBMJ
  47.                     SG9uZyBLb25nMRIwEAYDVQQHEwlIb25nIEtvbmcxDjAMBgNVBAoTBUNFQ0lEMSQwIgYDVQQLExtU
  48.                     aGUgVW5pdmVyc2l0eSBvZiBIb25nIEtvbmcxETAPBgNVBAMTCENFQ0lEIENBMB4XDTAzMDkxOTAz
  49.                     NDkwMloXDTEzMDkxNjAzNDkwMlowfjELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzES
  50.                     MBAGA1UEBxMJSG9uZyBLb25nMQ4wDAYDVQQKEwVDRUNJRDEkMCIGA1UECxMbVGhlIFVuaXZlcnNp
  51.                     dHkgb2YgSG9uZyBLb25nMREwDwYDVQQDEwhDRUNJRCBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
  52.                     gYkCgYEAtKg/Yh0mzTUAzmc9cbQilC2cToaIQiOp09DeGqhDjor8W0W6nzkTmbKHosPq0kGKL76J
  53.                     beM0TpKDkTzWYFW/d/p3Ru+b3AMo2DbJO5ETo5cMDrN7AaeQ/LWhzBgunAbpoN/bLI/npmCcDp+1
  54.                     np2SiOZGZRIMk/2QvkDSzCwP5b8CAwEAAaMjMCEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E
  55.                     BAMCAgQwDQYJKoZIhvcNAQEEBQADgYEAqXayWWHz8o9LIhX5kzQYrrm2JmSGTXoFG7Uy/+TtFdNx
  56.                     ymXwrLDpENT9uxQd1SHvrYUshzc295HWMruHOBIufguDZVxdyY+Le49F/TMhW7w8UhANf170DTsd
  57.                     rd2tfBLaCJbYTTocoKhq1cYbCOeL8S96NfGZT23UDAgNPcKCWJ4=
  58.             </ds:X509Certificate>
  59.         </ds:X509Data>
  60.       </ds:KeyInfo>
  61. </ds:Signature>

Mong các bạn giúp mình hướng giải quyết, hoặc từ khóa tìm kiếm để giải quyết vấn đề. Xin cảm ơn các bạn!