note 88455 added to function.openssl-pkey-get-public
| From: | thelen dot shar at gmail dot com | Date: | Sun, 25 Jan 2009 08:08:11 +0000 |
| Subject: | note 88455 added to function.openssl-pkey-get-public | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149746@lists.php.net to get a copy of this message | ||
Found it difficult to get my head around this due to lack of documentation.
But the process I followed for all this was:
Generate private key:
openssl genrsa -des3 -out private.pem 1024
Generate public key:
openssl rsa -in private.pem -out public.pem -outform PEM -pubout
Then in PHP:
$passphrase = 'somestring';
$key_private = openssl_get_privatekey(file_get_contents('private.pem'), $passphrase);
$key_public = openssl_get_publickey(file_get_contents('public.pem'));
Probably not the best way of doing it, but a lot simpler than the other examples on the site. I was
having trouble getting the pubkey, it wasn't exactly specified very well, and I had made a
mistake in generating it so it wasn't working for that reason as well.
----
Server IP: 117.104.160.194
Probable Submitter: 210.84.0.85
----
Manual Page -- http://www.php.net/manual/en/function.openssl-pkey-get-public.php
Edit -- https://master.php.net/note/edit/88455
Del: integrated -- https://master.php.net/note/delete/88455/integrated
Del: useless -- https://master.php.net/note/delete/88455/useless
Del: bad code -- https://master.php.net/note/delete/88455/bad+code
Del: spam -- https://master.php.net/note/delete/88455/spam
Del: non-english -- https://master.php.net/note/delete/88455/non-english
Del: in docs -- https://master.php.net/note/delete/88455/in+docs
Del: other reasons-- https://master.php.net/note/delete/88455
Reject -- https://master.php.net/note/reject/88455
Search -- https://master.php.net/manage/user-notes.php