OpenSSL "pkey -pubin" - View DH Public Key

Q

How to view contents of a DH public key file using OpenSSL "pkey" command?

✍: FYIcenter.com

A

If you want to view contents of a DH 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_dh_pub.key -text -noout
DH Public-Key: (1024 bit)
    public-key:
        2a:03:8c:35:7f:72:fc:43:8b:43:c2:f6:1f:22:8a:
        a0:fe:8b:98:33:40:d9:e8:7b:78:dd:ef:b4:4a:1d:
        6d:a9:67:7f:63:0e:f6:04:1a:d7:e0:5a:c8:3c:4c:
        0c:36:bf:23:42:29:97:31:3f:78:68:d8:14:4c:17:
        85:fb:27:b3:d3:c2:28:cc:14:c1:d0:6d:c1:b3:c9:
        8d:51:5a:67:02:3b:85:1f:91:16:15:37:ae:4d:b6:
        20:37:ce:6b:bb:84:16:a2:21:81:78:56:0a:68:15:
        c3:a5:51:cb:14:94:d7:1e:69:14:ba:cd:ce:6e:6b:
        41:86:34:ca:40:0d:38:5f
    prime:
        00:bc:e2:cd:16:1f:86:17:5c:d6:68:89:31:71:bc:
        f2:d2:82:09:d2:ce:48:81:bb:1b:61:6c:87:6e:de:
        73:8d:40:3f:ea:44:c6:24:fb:f3:53:ff:26:39:cb:
        9b:2f:39:36:2c:bd:3a:14:d9:0e:48:92:9c:0a:8d:
        89:63:be:0c:2f:f7:7a:52:0a:8c:77:f1:42:00:4c:
        31:df:b9:ec:c0:9d:b8:7f:4c:10:e5:44:40:a6:ff:
        76:b2:64:3c:57:82:05:28:49:94:cf:8a:ca:83:42:
        a4:b7:d5:d1:3b:bf:89:c6:ff:29:34:00:51:d8:90:
        03:47:1e:84:1b:53:36:6c:33
    generator: 2 (0x2)

Options used in this command are:

  • "-in my_dh_pub.key" - Read the DH public key file from: C:\Users\fyicenter\my_dh_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.

 

OpenSSL "genpkey" Command for DH Keys

⇒⇒OpenSSL Tutorials

2017-09-01, 395👍, 0💬