title: XAdES internally detached signature
body: <p>I want to create a file that contains multiple independent signatures referencing the same data. I want the data to be stored <strong>in</strong> the output XML file, as a sibling to <code>ds:Signature</code> elements, like below (only with multiple <code>ds:Signature</code> elements):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;internally-detached&gt;
    &lt;ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
      &lt;ds:SignedInfo&gt;
        &lt;ds:CanonicalizationMethod 
           Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/&gt;
        &lt;ds:SignatureMethod 
           Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/&gt;
        &lt;ds:Reference URI="#data"&gt;
          &lt;ds:DigestMethod 
            Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&gt;
          &lt;ds:DigestValue/&gt;
        &lt;/ds:Reference&gt;
      &lt;/ds:SignedInfo&gt;
      &lt;ds:SignatureValue/&gt;
    &lt;/ds:Signature&gt;
  
    &lt;document Id="data"&gt;
       &lt;title&gt;title&lt;/title&gt;
       &lt;author&gt;writer&lt;/author&gt;
       &lt;date&gt;today&lt;/date&gt;
       &lt;content&gt;
          &lt;para&gt;First paragraph&lt;/para&gt;
          &lt;para&gt;Second paragraph&lt;/para&gt;
       &lt;/content&gt;
    &lt;/document&gt;
  &lt;/internally-detached&gt;
  </code></pre>
  
  <p>Source: <a href="https://msdn.microsoft.com/en-us/library/ms759193(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms759193(v=vs.85).aspx</a>
  (I am aware that the site does not mention XAdES standard).</p>
  
  <p>I tried to apply this to a valid enveloping XAdES signature and putting the referenced <code>ds:Object</code> node outside the <code>ds:Signature</code> element, but the verification software returns an error (referenced node was not found), and the xades4j verification module fails after encountering the <code>&lt;/internally-detached&gt;</code> tag.</p>
  
  <p><strong>Is an internally detached signature possible with XAdES?</strong> If so, how can I achieve that?</p>
  
  <p>I know that multiple signatures are possible when the data is stored in a separate file: each signature's SignedProperties element must contain SignedDataObjectProperties with ObjectReference, and the URI in SignedInfo's Reference element should point to the file. </p>