javasecuritykeytool

What is the difference between keytool command's import and -importcert


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?


Solution

  • 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.