OpenSSL "pkey -pubin" - View RSA Public Key

Q

How to view contents of an RSA public key file using OpenSSL "pkey" command?

✍: FYIcenter.com

A

If you want to view contents of an RSA public key stored in a file, you can use the OpenSSL "pkey -pubin" command as shown below:

C:\Users\fyicenter>\local\openssl\openssl.exe

OpenSSL> pkey -pubin -in my_rsa_pub.key -text -noout
Public-Key: (1024 bit)
Modulus:
    00:c0:13:13:00:63:be:36:61:60:40:9e:ff:b7:35:
    30:08:f9:c5:11:95:04:2c:b3:32:6d:58:ef:ad:cf:
    6c:2b:ca:87:b4:5d:b0:f7:c7:4b:66:e6:d0:72:3a:
    37:19:ec:76:e9:ed:09:5a:51:17:f6:5e:69:37:68:
    dd:36:50:23:90:18:f1:bc:1b:8b:88:70:af:b6:bc:
    27:08:76:24:c2:c0:bd:83:ba:39:31:62:0e:6e:e6:
    00:2d:81:00:93:ac:d0:6a:26:21:a7:18:31:28:34:
    96:b1:02:f4:7f:3e:4a:85:33:c0:f6:be:fa:1a:b7:
    a8:b1:8a:c8:5a:ff:ad:f5:51
Exponent: 65537 (0x10001)

Options used in this command are:

  • "-in my_rsa_pub.key" - Read the RSA public key file from: C:\Users\fyicenter\my_rsa_pub.key.
  • "-pubin" - Read the input as a public key, instead of private key (together with public key).
  • "-text" - Print out key information in text format.
  • "-noout" - Do not include the key itself in the output.

The output shows that an RSA public key contains 2 components:

modulus, also called n - The modulus part of the public key
exponent, also called e - The exponent part of the public key

 

OpenSSL "genpkey rsa_keygen_bits:256" - RSA Short Keys

OpenSSL "pkey -pubout" - Extract RSA Public Key

OpenSSL "genpkey" Command for RSA Keys

⇑⇑ OpenSSL Tutorials

2018-01-13, 1840🔥, 0💬