title: Python signxml XML signature package. How to add xml placehoder for Signature tag?
body: <p>I am new to Python. I have installed signxml package and I am doing xml signature process.</p>
  <p>Link to python package : <a href="https://pypi.org/project/signxml/" rel="nofollow noreferrer">https://pypi.org/project/signxml/</a></p>
  <p>My xml file is getting generated. However XML signature code is little different. I was able to match most of the part but I donot have idea how to match following one.</p>
  <p>Can any one please help me for that.</p>
  <p><strong>Different part is following tag</strong></p>
  <pre><code>&lt;Signature&gt;
  </code></pre>
  <p><strong>Above part should be like this one</strong></p>
  <pre><code>&lt;Signature xmlns=&quot;http://www.w3.org/2000/09/xmldsig#&quot;&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/F5jag.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F5jag.png" alt="enter image description here" /></a></p>
  <p>When i searched into signxml core file i found following note.</p>
  <pre><code>To specify the location of an enveloped signature within **data**, insert a
  ``&lt;ds:Signature Id=&quot;placeholder&quot;&gt;&lt;/ds:Signature&gt;`` element in **data** (where
  &quot;ds&quot; is the &quot;http://www.w3.org/2000/09/xmldsig#&quot; namespace). This element will
  be replaced by the generated signature, and excised when generating the digest.
  </code></pre>
  <p>How to make change to get this changed.
  Following is my python code</p>
  <pre><code>from lxml import etree
  import xml.etree.ElementTree as ET
  from signxml import XMLSigner, XMLVerifier
  import signxml
  
  el = ET.parse('example.xml')
  root = el.getroot()
  
  #cert = open(&quot;key/public.pem&quot;).read()
  key = open(&quot;key/private.pem&quot;).read()
  
  signed_root = XMLSigner(method=signxml.methods.enveloped,signature_algorithm='rsa-sha512',digest_algorithm=&quot;sha512&quot;).sign(root, key=key)
  
  tree = ET.ElementTree(signed_root)
  
  
  #dv = tree.findall(&quot;.//DigestValue&quot;);
  #print(dv);
  
  tree.write(&quot;new_signed_file.xml&quot;)
  </code></pre>
  <p>What above code doing is. It takes one xml file and do digital signature process and generates new file.</p>
  <p>Can anyone please guide me where and what change should i do for this requirements ?</p>