Hi I encountered this error when trying to configure the keystory file for the coin apk file in android studio by commend prompt
Microsoft Windows [Version 10.0.22000.1455]
(c) Microsoft Corporation. All rights reserved.
C:\Users\deuts>keytool -genkey -v -keystoreC:\Users\deuts\Downloads\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Illegal option: -keystoreC
keytool -genkeypair [OPTION]...
Generates a key pair
Options:
-alias <alias> alias name of the entry to process
-keyalg <alg> key algorithm name
-keysize <size> key bit size
-groupname <name> Group name. For example, an Elliptic Curve name.
-sigalg <alg> signature algorithm name
-destalias <alias> destination alias
-dname <name> distinguished name
-startdate <date> certificate validity start date/time
-ext <value> X.509 extension
-validity <days> validity number of days
-keypass <arg> key password
-keystore <keystore> keystore name
-storepass <arg> keystore password
-storetype <type> keystore type
-providername <name> provider name
-addprovider <name> add security provider by name (e.g. SunPKCS11)
[-providerarg <arg>] configure argument for -addprovider
-providerclass <class> add security provider by fully-qualified class name
[-providerarg <arg>] configure argument for -providerclass
-providerpath <list> provider classpath
-v verbose output
-protected password through protected mechanism
Use "keytool -?, -h, or --help" for this help message
C:\Users\deuts>
I searched on Google and did not find anything I came across your site and found that you provide answers I hope to find a solution here
Related
I am trying to install a client certificate in my JVM to call a https soap service, but when running the
keytool -import command I get the below error:
**
keytool error: java.lang.Exception: Certificate not imported, alias already exists
**
Here is the command I am using, please note I am using Java11
**
C:\Softwares\java-11-openjdk-11.0.7.10-1.windows.redhat.x86_64\lib\security>keytool -import -keystore cacerts -file "C:\Softwares\client.certificate.pfx"
**
Please suggest.
Every entry in the java keystore is identified by a key called alias. It has to be unique for a given keystore. If you don't provide one, the default value the keytool uses is mykey. Looks like there is an entry with mykey already in your keystore. All you have to do is give a name yourself. You can do this using the alias attribute, like this:
keytool -import -keystore cacerts -file "C:\Softwares\client.certificate.pfx" -alias third_party_ca
You can use any name as long as it is unique.
My keystore is deleted, and I try to chat with Google playstore developer and I ask that my keystore app be reset, then they sent instructions like this:
Alternatively, you can use the following command line to generate a
new key:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
This key must be a 2048 bit RSA key and have 25-year validity.
Export the certificate for that key to PEM format:
keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Reply to this email and attach the upload_certificate.pem file.
My question is how to Export the certificate for that key to PEM format?
I try to using keytool.exe in folder C:\Program Files\Android\Android Studio\jre\bin the command prompt keytool.exe can not been write (force close)
keytool is provided in JDK, not JRE. You can install a JDK 1.8 for example and use keytool command from the path C:\Program Files\Java\JDK_1.8\bin\keytool.exe in Windows CMD terminal in Administrator mode(preferably).
The commands you provided are meant to generate a keypair and to export the certificate. So, if you have a proper keytool installed, you can execute your commands successfully and export the certificate.
For exporting certificate, if path not given it will export the ceritificate in bin folder.
Using keytool from the command-line, I added a new cert to a store. But the anger-inducing window manager that I find myself currently stuck with manages to fail at cut-and-paste, and replaced one of the characters of the alias with a ? character. How do I change or delete that alias?
keytool -list -keystore truststore
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 4 entries
hail.ucc.nau.edu:8636-cert-1?, Dec 1, 2017, trustedCertEntry,
.....
keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1?'
Enter keystore password:
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1?> does not exist
.....
keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1\?'
Enter keystore password:
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1\?> does not exist
.....
keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1'
Enter keystore password:
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1> does not exist
Thanks for any assistance,
- rob.
The special character you are seeing, may not be that actual character as suggested by #Pavel Lechev in the comment. If the keytool delete doesn't work, you can use the KeyStore Explorer software to do it. It has nice GUI providing all the keytool functionalities.
Or you could write a small tool/class using KeyStore api to delete your unwanted alias. You could list out all the aliases, identify it, and delete it (to identify the alias, you could do startsWith()).
I'm trying to create certificate key-store file with command line but it gives me an exception:
c:\Program Files\Java\jre7\bin>keytool.exe -genkey -alias srccodes -keyalg AES -
keystore C:\srccodes.jks -keysize 128
Enter keystore password:
Re-enter new password:
keytool error: java.lang.Exception: Cannot derive signature algorithm
-genkey option is for generating a public key and associated private key, so it only works with asymmetric algorithm (AES is symmetric so you can't use -genkey with it).
Use -genseckey instead. Note also that JKS can not store non public-key pairs, so you must use JCEKS format, to specify this add -storeType JCEKS, finally your command must be:
keytool.exe -genseckey-alias srccodes -keyalg AES -keystore C:\srccodes.jceks -keysize 128 -storeType JCEKS
For more info take a look at: Keytool documentation
Hope this helps,
I used the -validity property of the keytool to generate a keystore and self sign a jar. During the process, I saw the debug message that says
[info] Warning:
[info] This jar contains entries whose signer certificate will expire within six
months.
I am using the following commands,
keytool -genkey -alias signFiles -keypass mypass -keystore mystore -storepass mypass-alias store -validity 365
keytool -selfcert -keystore mystore -alias store
Am I doing something wrong here? Actually I wanted to sign the jar with a certificate for 1 year.
Cheers,
J
Add -validity 365 to your -selfcert command.