Difference between keytool -genkey vs -genkeypair

Thiru picture Thiru · Feb 14, 2017 · Viewed 10.1k times · Source

I am using keytool to create a csr. I wonder what is the difference between the options -genkey and -genkeypair. My understanding is that -genkey creates only private key and -genkeypair creates both private and public key. If so, how do I get the public key of the private key which is created using -genkey.

Answer

gp_xps picture gp_xps · May 28, 2017

Per https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html, this keytool flag was named -genkey in earlier releases. While the old name is still supported, -genkeypair is preferred going forward.

So essentially, both are the same