-1

I was generating my android app certificate in Windows 10 Administrator, this was the command I entered to generate the certificate for my app.

keytool -genkey -v -keystore c:\my-release-key.keystore -alias omar

Also as in the image you can see the error. But sorry for that but I am new to Android and this is a first time I was creating a certificate. Help is much appreciated.

The error is keytool error: java.lang.Exception: The -keyalg option must be specified

Password = " 123456 "

This question has been answer by Stephen. Thank you.

Omar The Dev
  • 123
  • 1
  • 14
  • 1
    [Under what circumstances may I add "urgent" or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) – Federico klez Culloca Apr 06 '21 at 10:34
  • 3
    Well I think this is a better answer: https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html#keytool_option_genkeypair ... which says that the `-keyalg` option is used to specify the algorithm for the keypair. Possible values are RSA, DSA, EC, DES and DESede. – Stephen C Apr 06 '21 at 10:42
  • 3
    And if you are in that much of a hurry, the **first** thing you should do is to find and read the manual! – Stephen C Apr 06 '21 at 10:44
  • same problem no change – Omar The Dev Apr 06 '21 at 10:45
  • Also, [don't post images of error messages](https://meta.stackoverflow.com/q/285551/3750257) – pppery Feb 03 '22 at 23:32

1 Answers1

3

Like the error message in your screenshot says.

The -keyalg option must be specified.

The following works for me:

$ keytool -genkey -keyalg RSA -v -keystore foo.jks -alias smith
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  steve
What is the name of your organizational unit?
  [Unknown]:  here
What is the name of your organization?
  [Unknown]:  there
What is the name of your City or Locality?
  [Unknown]:  here
What is the name of your State or Province?
  [Unknown]:  there
What is the two-letter country code for this unit?
  [Unknown]:  AU
Is CN=steve, OU=here, O=there, L=here, ST=there, C=AU correct?
  [no]:  yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 90 days
    for: CN=steve, OU=here, O=there, L=here, ST=there, C=AU
[Storing foo.jks]

For more information, please refer to the Oracle KeyTool Documentation.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216