This site is an archive and is no longer updated.
    Java & KeytoolIntermediate

    Java Keytool Commands

    Essential keytool commands for managing Java keystores. Import, export, list, and delete certificates and keys.

    Interactive Demo
    LinkedInX
    keytool Visualizer

    Interactive keytool Builder

    Select an operation, customize the parameters, and copy the generated command. All commands use PKCS12 format (recommended).

    Read Full Guide

    Generate Key Pair

    $ keytool -genkeypair \
      -alias mykey \
      -keyalg RSA -keysize 2048 \
      -keystore keystore.p12 -storetype PKCS12 \
      -validity 365 \
      -dname "CN=localhost,O=MyOrg,C=US" \
      -storepass changeit -keypass changeit

    Quick Reference: Common Options

    -storetype PKCS12

    Use PKCS12 format (recommended)

    -storepass <password>

    Keystore password

    -keypass <password>

    Private key password (if different)

    -noprompt

    Don't prompt for confirmation