Search code examples
phpopensslx509csr

In PHP how do I get a CSR's public key?


I have a web page which takes a CSR (certificate signing request) and signs them. Problem is: I dont know how to extract the public key from the CSR. I tried openssl_csr_get_public_key($request) where request is the string holding the pem encoded request, but that doesn't seem to work. Any ideas on how to do this?

Thanks!


Solution

  • Make sure that the csr is correctly formatted. Check that PHP isnt changing plusses into spaces or something of the sort.