title: Signing an XML file (PHP)
body: <p>I am facing an issue while trying to sign an XML file to make a soap request.
  Here is the function I am using to get the signature in a variable:</p>
  
  <pre><code>private function signXml() {
  
      $doc = new DOMDocument();
      $doc-&gt;loadXML($this-&gt;xml);
  
      foreach($doc-&gt;getElementsByTagNameNS('*', 'SignedInfo') as $elm) {
          $SignedInfo =  $elm-&gt;c14n(); 
  
          $key = openssl_pkey_get_private ( file_get_contents($this-&gt;lc_key) , $this-&gt;lc_Password); //file_get_contents($this-&gt;key);
  
          if ( openssl_sign($SignedInfo, $crypt, $key, OPENSSL_ALGO_SHA1) ) {
              $this-&gt;data['SignatureValue'] = base64_encode($crypt);
          } else {
              throw new Exception('XML signature failed !');
          }
      }
  }
  </code></pre>
  
  <p>When I use SoapUI to generate the signature, the request is successfully processed by the server. But when I use my php script I get a different signature, though the digestValues is the same and the server rises an Internal Error.</p>
  
  <p>This are the standards I should use:</p>
  
  <p>Key Identifiert Type => Binary Security Token </p>
  
  <p>Signature Algorithm => <a href="http://www.w3.org/2000/09/xmldsig#rsa-sha1" rel="nofollow">http://www.w3.org/2000/09/xmldsig#rsa-sha1</a></p>
  
  <p>Signature Canonicalization => <a href="http://www.w3.org/2001/10/xml-exc-c14n#" rel="nofollow">http://www.w3.org/2001/10/xml-exc-c14n#</a> </p>
  
  <p>Digest Algorithm => sha1</p>
  
  <p>Signed Message Part => Body</p>