Search code examples
linuxkeystore

keytool error: java.lang.RuntimeException: Usage error, –storepass is not a legal command


I am getting following error when trying to run below command

keytool error: java.lang.RuntimeException: Usage error, –storepass is not a legal comman

keytool -genkey -dname "CN=apptest2, OU=A, O=te ha,L=Delhi, S=Delhi, C=IN" -alias "ssocertificate" -keyalg RSA -keypass P@ssw0rd -keystore /etc/cas/certificate/portal.keystore –storepass storepass -keyalg "RSA" -ext SAN=dns:apptest2,ip:105.210.22.145

I tried to add double quotes"" for storepass but same exception


Solution

  • The problem is (as the error clearly states), that the program doesn't know the option –storepass (rather than the argument to that option).

    Now the dash that starts that argument looks suspiciously like an m-dash, rather than a minus-sigen - as expected by any standard argument parser.

    So you should use -storepass rather than –storepass