title: openssl_sign and "supplied key param cannot be coerced into a private key"
body: <p>I have problem with the function <code>openssl_sign</code> because return this error  </p>
  
  <blockquote>
    <p>Warning: openssl_sign(): supplied key param cannot be coerced into a private key ...</p>
  </blockquote>
  
  <p>This is my code and I hope for your help: </p>
  
  <pre><code>&lt;?php
      $debug=true; 
      $data=file_get_contents(realpath("C:/Users/User/Desktop/xampp/htdocs/server.key"));
      $doc=file_get_contents(realpath("C:/Users/User/Desktop/xampp/htdocs/docum.docx"));
      echo $debug ? $data : '';
      $priv_key = openssl_pkey_get_private( $data );
      $sign="";
      $digitalS=openssl_sign ($doc,$sign, $priv_key);
  ?&gt;
  </code></pre>
  
  <p>I have created the certificate and private key with openssl , now I would like to sign the document... What's wrong with this code ?</p>