Search code examples
windowsjava-8defaultkeystorekeytool

what is the default keystore file name and location that java 8 keytool use?


given the command c:\java\jre8\bin\keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048

as you can see I forgot to tell the file name and location all went well and keystore seems to be created BUT where the keystore file was created?!


Solution

  • default filename will be .keystore

    and location c:\Users\<CurrentUser>\.keystore

    thanks to this answer that gave me a hint

    Now that I know it it kind of makes sense.

    additionally from the docs:

    -keystore keystore
    The keystore location.
    ...
    For example, if keytool -genkeypair is invoked and the -keystore option is not specified,
    the default keystore file named .keystore in the user's home directory will be created if it does not already exist.
    Similarly, if the -keystore ks_file option is specified but ks_file does not exist, then it will be created