OpenSSL "dsa -pubout" - Extract DSA Public Key

Q

How to extract the public key from a DSA key file using OpenSSL "dsa" command?

✍: FYIcenter.com

A

If you want to extract the public key out from a DSA key file (private key an public key), you can use the OpenSSL "dsa -pubout" command as shown below:

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

OpenSSL> dsa -in my_dsa_2048.key -pubout -out my_dsa_2048_pub.key
read DSA key
writing DSA key
OpenSSL> exit

C:\Users\fyicenter>type my_dsa_2048_pub.key
-----BEGIN PUBLIC KEY-----
MIIDRzCCAjkGByqGSM44BAEwggIsAoIBAQDT02QRQs8aROwvEpk83Nl9tNRI6IAO
/ov/nnaYiOcr4RoOnGbNS4bQGxxvJrd7QBx+9/OStbqiSxNtL1FH8NcgKhZ6Xpmc
z+FJWMMoNS1saWNxfPuHnV9/rN9ABSwy9cIzFP8xruv0q0LGUeD9EMxRunlzz1fy
F8ou6WaXo5aPYVP/38FQ451JyiMU8V6+qzkdtAIHhKVZ8vG6YGnaoxBtDnq75fDC
uDcQKLOKzAiL+D+i6SgZOU6djRzilTwpttehuYw/GEh/6dVzwQ0XoJc4+gNsevXC
b0ZiaYO12/bf0WzA/ET2TwDcrMtrxRtiYx+tefRr/2Gf/PIuQdsPhczhAiEAzXOV
gMgMFhE8f2xziQ3CUMpBuSTSPwtiNNwe7JOx4iECggEAWfrVHrfGfEZ2gYcLYXCJ
nhTRaxMcXHpFRBIuCpf03iP23ghcEdDy5i2vZcvwzjrcucIKYukLdglWgQuxhQCS
mgnmF/CMotzgvrWN3st9P+Sj3pGEdA0twH8w5vVcqZBQOrgZJq0cIOG+ZX2zc07E
JKUlp7XGeLT/rGSirHaVuTUrq8WiVZj8aSkZZ10Ng4mAvqX1CWMHJ3yFdhid0aF1
uXwKmbvjoHEPojcBg7O4Ls/i0CHOkttoYFiHcEFrGMe+epjZfBB2DcssZAjntZV7
dPK9PupRnNmyGCIWEp7G/YpJNiQxDI+NiwDR5JIiiVMUZAtRAhnJxilfhPOJ4khL
IAOCAQYAAoIBAQCwYs1WWrrMJ317jPTuVGDRf2SKDPl+3Hpw3XbhCsg90uB2EAEk
T62BMdozrsCK99ajW6MVhlBl/TGf2sZPj28R+3s034LLaOV4+3Ms/VIEEpG55IzY
4Nq9c7RslhYIO4hChGEeCzVg9xWJPmp88wIkM1Jy8GHDB9Xm+cM7hSkFUoLwNH87
pocC5gZvMbUMa8859R2yAkHXzfMHNEDLtSchZLBxuy1H3HjDWzagjicNNEXnqdd0
8dmGHhiWt4mxhJDJLqWDd6Oe1KBGr6DK2lYGxTgiPPuOw330pnQnZpXNoLoGNrQr
pV5DVGSswKW0oCIPiwtxMeL3K+8FhIBvfAxW
-----END PUBLIC KEY-----

Options used in this command are:

  • "-in my_dsa_2048.key" - Read the DSA key (private key and public key pair) file.
  • "-pubout" - Extract the public key out of the DSA key file.
  • "-out my_dsa_2048_pub.key" - Save the public key in a file with no password protection.

 

OpenSSL "dsa -pubin" - View DSA Public Key

OpenSSL "dsa -text" - Print DSA Key in Text

OpenSSL "gendsa" and "dsa" Commands

⇑⇑ OpenSSL Tutorials

2016-12-28, 883👍, 0💬