title: openssl_pkey_export and "cannot get key from parameter 1"
body: <p>I need to use openssl within my php project, so I created a test php page using openssl. However, I keep getting these errors and I am not sure why. openssl is enabled.</p>
  <blockquote>
  <p>Warning: openssl_pkey_export() [function.openssl-pkey-export]: cannot get key from parameter 1 in C:\wamp\www\opensslsample\index.php on line 18</p>
  <p>Warning: openssl_pkey_get_details() expects parameter 1 to be resource, boolean given in C:\wamp\www\opensslsample\index.php on line 21</p>
  </blockquote>
  <pre><code>&lt;?php
   //echo phpinfo();
  
     $privateKey = openssl_pkey_new(array(
  'private_key_bits' =&gt; 1024,
  'private_key_type' =&gt; OPENSSL_KEYTYPE_RSA,
  ));
  
  openssl_pkey_export($privateKey, $privkey,&quot;123&quot;);
  
  $pubkey=openssl_pkey_get_details($privateKey);
  $pubkey=$pubkey[&quot;key&quot;];
  ?&gt;
  </code></pre>