Search code examples
sslssl-certificatekeystore

I cannot generate a new keystore in java


I followed the steps jsse reference guide for java 7. I wrote this command to command prompt:

keytool -genkeypair -alias duke -keyalg RSA \ -validity 7 -keystore keystore

However it throws error in command prompt: "Use "keytool -help" for all available commands"

Do you have any ideas for solving this problem?


Solution

  • From the jsse reference guide:

    Solution 2: To interact with Navigator or IE, you should create certificates that use RSA-based keys. To do this, you need to specify the -keyalg RSA option when using keytool. For example:
    
    keytool -genkeypair -alias duke \
        -keystore testkeys -keyalg rsa
    

    The backslash \ is to escape the newline, it looks like you are putting everything on the same line and keeping the \. Try removing it

    keytool -genkeypair -alias duke -keyalg RSA -validity 7 -keystore keystore