1

I think that on my machine (Debian 10, linux, JAVA 1.8 OpenJDK), ECDSA isn't supported by Java.

Why? Because this line throws exception:

KeyFactory kf = KeyFactory.getInstance("ECDSA");

However, if I change ECDSA to RSA for example, no exception is raised then.

I'm using Debian GNU/Linux as mentioned. Should I install some package or something like that?

Thanks

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
Tal
  • 347
  • 2
  • 16

1 Answers1

6

As a KeyFactory, it appears that the name is just "EC", not "ECDSA".


You can list the available key factories using the following code (Java 5+):

for (Provider provider : Security.getProviders()) {
    System.out.println(provider.getName());
    for (Service service : provider.getServices()) {
        if (service.getType().equals("KeyFactory"))
            System.out.println("  " + service.getAlgorithm());
    }
}

I've run it on various Java versions on my Windows 7 machine. As you can see below, Java for Windows comes with the following Key Factories:

  • DSA
  • RSA
  • EC   (Java 7+)
  • RSA
  • DiffieHellman

Java 9.0.1

SUN
  DSA
SunRsaSign
  RSA
SunEC
  EC
SunJSSE
  RSA
SunJCE
  DiffieHellman
SunJGSS
SunSASL
XMLDSig
SunPCSC
JdkLDAP
JdkSASL
SunMSCAPI
SunPKCS11

Java 1.8.0_151

SUN
  DSA
SunRsaSign
  RSA
SunEC
  EC
SunJSSE
  RSA
SunJCE
  DiffieHellman
SunJGSS
SunSASL
XMLDSig
SunPCSC
SunMSCAPI

Java 1.7.0_79

SUN
  DSA
SunRsaSign
  RSA
SunEC
  EC
SunJSSE
  RSA
SunJCE
  DiffieHellman
SunJGSS
SunSASL
XMLDSig
SunPCSC
SunMSCAPI

Java 1.6.0_45

SUN
  DSA
SunRsaSign
  RSA
SunJSSE
  RSA
SunJCE
  DiffieHellman
SunJGSS
SunSASL
XMLDSig
SunPCSC
SunMSCAPI

Java 1.5.0_22

SUN
  DSA
SunRsaSign
  RSA
SunJSSE
  RSA
SunJCE
  DiffieHellman
SunJGSS
SunSASL
Andreas
  • 154,647
  • 11
  • 152
  • 247