3

I was given a certificate and tried to extract public key out of it.

My certificate is like

-----BEGIN CERTIFICATE----- 
SNFMFGFDGIIG ....
-----END CERTIFICATE-----

and I saved it as test.cer.

I have looked up online and tried to extract public key.

I tried:

openssl x509 -inform pem -in test.cer -pubkey -noout > publickey.pem

but I am getting

unable to load certificate
56091:error:0906D06C:PEM routines:PEM_read_bio:no start line:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59.60.1/src/crypto/pem/pem_lib.c:648:Expecting: TRUSTED CERTIFICATE

I am not that familiar with the process and was hoping someone here can help me out. Thanks so much!

Jwqq
  • 997
  • 4
  • 14
  • 22
  • Install a modern version of OpenSSL and put it on path. Also see [Homebrew refusing to link OpenSSL](http://stackoverflow.com/q/38670295), [Update OpenSSL on OS X with Homebrew](http://stackoverflow.com/q/15185661), [How to install latest version of openssl Mac OS X El Capitan](http://stackoverflow.com/q/35129977), [How to upgrade OpenSSL in OS X?](http://apple.stackexchange.com/q/126830), [Openssl installation using HomeBrew fails](http://superuser.com/q/486389), etc. – jww Apr 07 '17 at 05:10
  • @jww My openSSL version seems pretty up to date. OpenSSL 0.9.8zh 14 Jan 2016. Is upgrading really needed to solve this? – Jwqq Apr 07 '17 at 05:22
  • OpenSSL 0.9.8 was end of life back in 2015. OpenSSL 0.9.8 is so old it can't handle most elliptic curve stuff. I think the first step is to get to a modern version of OpenSSL. – jww Apr 07 '17 at 05:29
  • @jww gotcha. thanks – Jwqq Apr 07 '17 at 05:47
  • Did upgrading OpenSSL solve your problem? – Slav Feb 07 '22 at 20:03

0 Answers0