27

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?

informatik01
  • 16,038
  • 10
  • 74
  • 104
Thiru
  • 381
  • 1
  • 3
  • 6

2 Answers2

35

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

gp_xps
  • 639
  • 1
  • 8
  • 12
4

Hi there in old version of java was named -genkey which is stil supported

This command was named -genkey in earlier releases. The old name is still supported in this release. The new name, -genkeypair, is preferred going forward.

Keytool Java 8 documentation

Community
  • 1
  • 1
Hhovhann
  • 511
  • 1
  • 6
  • 22