title: How to compute the digest for the SignedProperties of a XAdES signature?
body: <p>I've been struggling for several days about how to compute the digest for the SignedProperties element in a XAdES signature. I have a reference XML file with the two digest values computed (the file being signed and and the signed properties), and I know it's good because it passes the verifiers. I computed the right digest value for the file being signed, but whatever I give as an input to the digest method (I use OpenSSL), I cannot get the same value that in the reference file. Of course my own file don't pass the verifier after that. I use the following command to compute the digest:</p>
  
  <pre><code>openssl dgst -sha256 -binary myfile.xml | openssl base64
  </code></pre>
  
  <p>I recorded the file myfile.xml by extracting the SignedProperties element of the reference file and saved it as is.</p>
  
  <pre><code>&lt;xades:SignedProperties Id="xmldsig-f6a6a2a1-87af-4720-8eed-cf4532e99106-signedprops"&gt;&lt;xades:SignedSignatureProperties&gt;&lt;xades:SigningTime&gt;2015-09-22T09:02:48.624+02:00&lt;/xades:SigningTime&gt;&lt;xades:SigningCertificate&gt;&lt;xades:Cert&gt;&lt;xades:CertDigest&gt;&lt;ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/&gt;&lt;ds:DigestValue&gt;cAJECbIzXZiLH+ILWPrM5jfA13GKcEC8t1qe7/BxqBM=&lt;/ds:DigestValue&gt;&lt;/xades:CertDigest&gt;&lt;xades:IssuerSerial&gt;&lt;ds:X509IssuerName&gt;CN=thawte SHA256 Code Signing CA,O=thawte\, Inc.,C=US&lt;/ds:X509IssuerName&gt;&lt;ds:X509SerialNumber&gt;13010307134774063901853305426952669967&lt;/ds:X509SerialNumber&gt;&lt;/xades:IssuerSerial&gt;&lt;/xades:Cert&gt;&lt;/xades:SigningCertificate&gt;&lt;/xades:SignedSignatureProperties&gt;&lt;xades:SignedDataObjectProperties&gt;&lt;xades:DataObjectFormat ObjectReference="#xmldsig-f6a6a2a1-87af-4720-8eed-cf4532e99106-ref0"&gt;&lt;xades:Description&gt;signature détachée du fichier indexfile.txt&lt;/xades:Description&gt;&lt;xades:MimeType&gt;text/plain&lt;/xades:MimeType&gt;&lt;/xades:DataObjectFormat&gt;&lt;/xades:SignedDataObjectProperties&gt;&lt;/xades:SignedProperties&gt;&lt;/xades:SignedProperties&gt;
  </code></pre>
  
  <p>Apparently, I should get the value :</p>
  
  <pre><code>6JK3GHDL25+EIRefNMQJ3SOGSI8uzQ45PiziMomZkYs=
  </code></pre>
  
  <p>But I can't get it. I don't know if some transformations or canonicalization must be applied, the specification is very vague about this part. It's encoded in UTF-8, no line feeds.</p>
  
  <p>Does anyone how to do this ? Any trick ?</p>