Douglas Held
Douglas Held

Reputation: 1461

Why would keytool report 'NoSuchAlgorithmException; cannot support algorithm "RSA"'?

I thought I would share the workaround I discovered today. It is not possible to create an RSA key in the manner I'm used to anymore....

Steps to reproduce:

  1. Install Java Development Kit jdk-6u30-windows-x64.exe on a Windows Server 2008 R2. Include the Public JRE.

  2. Run the JRE's bin\keytool utility with the following parameters:

    keytool -genseckey -alias FOO -keystore FOO.jks -keyalg RSA -validity 1825

Expected results:

Self signed certificate creation wizard

Actual results:

NoSuchAlgorithmException; cannot support algorithm "RSA"

Workaround:

Of course I tried using lowercase "rsa" but this did not work. What worked was to use the undocumented former method "-genkey" instead of "-genseckey"

Upvotes: 2

Views: 4259

Answers (1)

4ndrew
4ndrew

Reputation: 16212

The -genkey is obsolete parameter, in jdk6 is was replaced by -genkeypair. Use -genkeypair instead of -genseckey if you want to generate RSA keypair.

Upvotes: 6

Related Questions