OpenSSL - Display RSA private key file hex

by
Jeremy Canfield |
Updated: February 16 2022
| OpenSSL articles
Let's say you have an private key file, foo.key. The file command can be used to ensure the file is a private key, and to display the type of private key (RSA in this example).
~]# file foo.cer
foo.key: RSA private key
In this scenario, the cat command (on Linux) can be used to view the encrypted content of foo.key. Something like this should be returned.
~]# cat foo.key
-----BEGIN RSA PRIVATE KEY-----
Proc-TYpe: 4,ENCRYPTED
DEK-Info: AES-256-CBC,C00...
MIIGhTCCBW2gAwIBAgITFwAS0Zj4+uylATknJgAAABLRmDANBgkqhkiG9w0BA...
-----END RSA PRIVATE KEY-----
In this example, the openssl command with the rsa option can be used to display the hex of foo.key.
openssl rsa -in foo.key -text -noout
Did you find this article helpful?
If so, consider buying me a coffee over at