keytool -genkey error: Keystore file does not exist

后端 未结 5 585
有刺的猬
有刺的猬 2020-12-28 18:31

I try to create a new self certified keystore file

The command I use is:

keytool -genkey -selfcert -dname \"cn=My Name, ou=Orga unit\" -alias selfcer         


        
相关标签:
5条回答
  • 2020-12-28 18:32

    First generate the upload key using below command:

    keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
    

    then run

    keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v 
    
    0 讨论(0)
  • 2020-12-28 18:41

    Seems a old link but this is what I tried - Hope this helps someone. In my case as .keystore file was missing in the below location, I had run the following command; keytool -genkey -alias mykey -keystore "C:\Users\username.keystore" This creates a .keystore file in the location, system asks you for information like What is your first and last name? What is the name of your organizational unit? What is the name of your organization? What is the name of your City or Locality? What is the name of your State or Province? What is the two-letter country code for this unit? Is CN=XXX, OU=XXX, O=XXX, L=XXX, ST=XXX, C=IN correct?

    Say "Yes" and the keystore will get created.

    0 讨论(0)
  • 2020-12-28 18:48

    Run command prompt as Administrator and it will be done.

    0 讨论(0)
  • 2020-12-28 18:57

    Generating a key pair (and a new keystore) has to be done as a separate operation to creating a self-signed certificate for that key.

    i.e.

    keytool -genkey -alias myKey -keystore store.jks
    keytool -selfcert -alias myKey -keystore store.jks
    
    0 讨论(0)
  • 2020-12-28 18:59

    -selfcert option was made obsolete in keytool for Java 6. Check the last section of "Changes" here: Java 6 Keytool

    So for Java 6 and onwards, replace -selfcert with -certreq

    0 讨论(0)
提交回复
热议问题