OpenSSL "pkey -text" - Print DH Key in Text

Q

How to print private key contents in text format using OpenSSL "pkey" command?

✍: FYIcenter.com

A

If you want to see contents of a private key in text format, you can use the OpenSSL "pkey -text" command as shown below:

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

OpenSSL> pkey -in my_dh.key -text -noout
DH Private-Key: (1024 bit)
    private-key:
        51:ad:3b:4f:28:a2:2f:0a:f1:80:6c:c7:20:b0:21:
        c3:0f:83:dc:e3:d0:06:3a:f7:9d:4c:4f:af:8c:2c:
        94:67:ff:67:19:20:08:b3:1f:72:04:27:07:33:2d:
        b3:62:35:f2:7e:58:8f:91:cc:92:c1:b1:f6:22:f8:
        c1:f6:e9:4b:82:a3:80:6d:b5:e8:ca:92:93:cd:43:
        38:84:3d:0c:5f:3a:56:cb:9a:61:2b:d1:03:68:15:
        92:dc:5f:f6:03:e7:9c:2f:55:b1:38:5c:b8:4b:8c:
        29:14:b5:72:c0:4d:55:21:23:01:b4:bb:29:2e:d1:
        5a:bb:78:99:ca:2a:6b:6d
    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.key" - Read the private key file
  • "-text" - Print out key information in text format.
  • "-noout" - Do not include the key itself in the output.

 

OpenSSL "pkey -pubout" - Extract DH Public Key

OpenSSL "genpkey -paramfile" - Generate DH Key

OpenSSL "genpkey" Command for DH Keys

⇑⇑ OpenSSL Tutorials

2017-08-25, 1496🔥, 0💬