Home > Archive > PHP Programming > August 2005 > Getting public key using openssl_*
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Getting public key using openssl_*
|
|
| diogoko 2005-08-25, 3:55 am |
| Has anyone been sucessful in getting/reading a RSA or DSA public key
using the openssl functions?
openssl_get_publickey should work with PEM files, but it doesn't...
I've tried creating a X.509 certificate, putting the public key in
there and getting it out with openssl_get_publickey, but it doesn't
work either...
All I want to do is to decrypt some data using a public key received
from the user. Ideas?
| |
| diogoko 2005-08-27, 3:55 am |
| > openssl_get_publickey should work with PEM files, but it doesn't...
Actually it does, if you give it the key in the right format. Something
like:
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCu
I6b3auKaUF67XLchzhhfnhsw
r3MsxQ3mjJsN7cq96RwIiaUgOtm0revhQB4JX0m1
x1uI4GzTevMsRKZepNnt5lvi
UXaZ8ztl4ryvKVzYdqfooJI78jRsP//Ss8gWeq7/No9xTdY9jWUKS6Zw01v6C77h
tCv22DfDf5gGRfcq1wIDAQAB
-----END PUBLIC KEY-----
I managed to create the public key from the private key using the
openssl command line tool:
$ openssl rsa -in private_key -pubout -out public_key
|
|
|
|
|