note 101839 added to function.openssl-pkey-export

From: Date: Thu, 13 Jan 2011 16:51:02 +0000
Subject: note 101839 added to function.openssl-pkey-export
Groups: php.notes 
Request: Send a blank email to php-notes+get-175717@lists.php.net to get a copy of this message
Please take note that older versions of PHP/OpenSSL exports the RSA private key with '-----BEGIN RSA PRIVATE KEY-----' PEM tag, which includes just the privateKey field, thus omitting the version and privateKeyAlgorithm fields. The effect of that would be that if you're converting it to DER, and then back to PEM, but using '-----BEGIN PRIVATE KEY-----' PEM tag, that the openssl_pkey_get_privatekey() function will fail! Senthryl's code can be used to prefix the PEM encoded data with the version and privateKeyAlgorithm fields again. The newer PHP/OpenSSL versions exports the RSA private key with '-----BEGIN PRIVATE KEY-----' PEM tag, which includes the version and privateKeyAlgorithm fields. I noticed these differences between my two servers: PHP Version 5.3.3 (OpenSSL 1.0.0a-fips 1 Jun 2010) on Fedora Core 12 x64 PHP Version 5.2.9 (OpenSSL 0.9.8g 19 Oct 2007) on Fedora Core 10 x64 ---- Server IP: 69.147.83.197 Probable Submitter: 41.134.19.138 ---- Manual Page -- http://www.php.net/manual/en/function.openssl-pkey-export.php Edit -- https://master.php.net/note/edit/101839 Del: integrated -- https://master.php.net/note/delete/101839/integrated Del: useless -- https://master.php.net/note/delete/101839/useless Del: bad code -- https://master.php.net/note/delete/101839/bad+code Del: spam -- https://master.php.net/note/delete/101839/spam Del: non-english -- https://master.php.net/note/delete/101839/non-english Del: in docs -- https://master.php.net/note/delete/101839/in+docs Del: other reasons-- https://master.php.net/note/delete/101839 Reject -- https://master.php.net/note/reject/101839 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175717) next »