9

I was told to add a certificate (.crt format) to the keystore file using keytool command. What option need to be used here, import or -importcert. When is each one used?

Java Explorer
  • 93
  • 1
  • 5
  • [keytool unix](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html)/[keytool windows](https://docs.oracle.com/javase/8/docs/technotes/tools/windows/keytool.html) has no "import" command. – Oleg Estekhin Apr 03 '17 at 15:32
  • @OlegEstekhin : both links say "This command was named -import in earlier releases. This old name is still supported in this release. The new name, -importcert, is preferred going forward." – Arnaud Apr 03 '17 at 15:38
  • @OlegEstekhin we use JDK 5 – Java Explorer Apr 03 '17 at 15:52

1 Answers1

11

From this documentation keytool - Key and Certificate Management Tool, the Changes section at the end of the page says :

Renamed commands:

-import, renamed to -importcert

So they basically are the same, and despite being renamed, -import should still exist later :

All previous commands (both renamed and obsolete) are still supported in this release and will continue to be supported in future releases.

Note that this is from the Java SE 7 documentation, but the one from Java SE 8 (unix/windows) also says :

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

Community
  • 1
  • 1
Arnaud
  • 17,229
  • 3
  • 31
  • 44