title: Cannot sign anything with PHP openssl_sign?
body: <p>I am attempting to use PHP-DKIM to send DKIM signed emails. Its a little old so I've had to change some things, but this stumps me:</p>
  
  <pre><code>Warning: openssl_sign() [function.openssl-sign]: supplied key param cannot be coerced into a private key in /.../pages/user/dkim.php on line 66
  Cannot sign
  </code></pre>
  
  <p>Relevant section of code (note I've added the $pkeyid, originally the private key was just passed straight to the <code>open_ssl</code> function which also didn't work)</p>
  
  <pre><code>$pkeyid = openssl_get_privatekey($open_SSL_priv);
  if (openssl_sign($s, $signature, $pkeyid))
      return base64_encode($signature) ;
  else
      die("Cannot sign") ;
  </code></pre>
  
  <p>So obviously something really bad is going on here. However I know my private key and public key are valid. I even tried the example key provided in the <a href="http://www.php.net/manual/en/function.openssl-sign.php#77571" rel="nofollow">comments for <code>openssl_sign</code></a> which didn't work</p>
  
  <pre><code>$open_SSL_pub=&lt;&lt;&lt;EOD
  -----BEGIN PUBLIC KEY-----
  MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANDiE2+Xi/WnO+s120NiiJhNyIButVu6
  zxqlVzz0wy2j4kQVUC4ZRZD80IY+4wIiX2YxKBZKGnd2TtPkcJ/ljkUCAwEAAQ==
  -----END PUBLIC KEY-----
  EOD;
  
  $open_SSL_priv=&lt;&lt;&lt;EOD
  -----BEGIN RSA PRIVATE KEY-----
  MIIBOgIBAAJBANDiE2+Xi/WnO+s120NiiJhNyIButVu6zxqlVzz0wy2j4kQVUC4Z
  RZD80IY+4wIiX2YxKBZKGnd2TtPkcJ/ljkUCAwEAAQJAL151ZeMKHEU2c1qdRKS9
  sTxCcc2pVwoAGVzRccNX16tfmCf8FjxuM3WmLdsPxYoHrwb1LFNxiNk1MXrxjH3R
  6QIhAPB7edmcjH4bhMaJBztcbNE1VRCEi/bisAwiPPMq9/2nAiEA3lyc5+f6DEIJ
  h1y6BWkdVULDSM+jpi1XiV/DevxuijMCIQCAEPGqHsF+4v7Jj+3HAgh9PU6otj2n
  Y79nJtCYmvhoHwIgNDePaS4inApN7omp7WdXyhPZhBmulnGDYvEoGJN66d0CIHra
  I2SvDkQ5CmrzkW5qPaE2oO7BSqAhRZxiYpZFb5CI
  -----END RSA PRIVATE KEY-----
  EOD;
  </code></pre>
  
  <p>I'm at a loss of what to do. OpenSSL "0.9.8e-fips-rhel5 01 Jul 2008" is installed and active in PHP. Both the key I generated and that key are known working. So why does <code>openssl_sign</code> keep failing?</p>