How do I use the openssl command to decode a public key .PEM file?

I have my localhost TSL/SSL certificate from Chrome stored to a .PEM file. Was wondering how do I use the oppenssl command to decode it into a list of human-readable fields.

Googling this only returned info on how to work with the private key.

There are online utilities for decoding a public key, but I need a method I can easily access programatically using Python. I couldn't find anyway to do this using a library, so I thought the openssl command might work.

The public key text in the .PEM file is the standard public key format that does work in the online decoding utilities.

Thank you!

1

2 Answers

how do I use the oppenssl command to decode it into a list of human-readable fields.

openssl x509 -in NAME.pem -text -noout

Replace 'NAME' with whatever filename your .pem file has.

2

If you want to view a public key in PKCS#1 format, you can use:

openssl rsa -pubin -in <file> -text

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like