Using EdDSA triggers NoSuchAlgorithmException
Issue #207
invalid
Trying to use the EdDSA algorithm leads to the following exception.
org.jose4j.lang.JoseException: Couldn't find EDDSA KeyPairGenerator! java.security.NoSuchAlgorithmException: EDDSA KeyPairGenerator not available
at org.jose4j.keys.KeyPairUtil.getKeyPairGenerator(KeyPairUtil.java:77)
at org.jose4j.keys.OctetKeyPairUtil.generateKeyPair(OctetKeyPairUtil.java:45)
at org.jose4j.jwk.OkpJwkGenerator.generateJwk(OkpJwkGenerator.java:24)
at org.jose4j.jwk.OkpJwkGenerator.generateJwk(OkpJwkGenerator.java:13)
This is because getAlgorithm()
in src/main/java/org/jose4j/keys/EdDsaKeyUtil.java
returns “EDDSA” which is not a valid algorithm. It should return ED25519
or ED448
depending on which algorithm is actually being used.
Comments (5)
-
repo owner -
reporter Yes, sorry. Apparently, I got my Java versions mixed up. This was on Java11 which does not support EDDSA yet
-
reporter - marked as trivial
-
repo owner - changed status to open
-
repo owner - changed status to invalid
- Log in to comment
On what version of java are you encountering this? EdDSA support was introduced in Java 17 AFAIK.
It is a standard KeyPairGenerator algorithm name: https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html#keypairgenerator-algorithms
And this works https://bitbucket.org/b_c/jose4j/wiki/JWT Examples#markdown-header-producing-and-consuming-signed-and-encrypted-jwt-using-rfc8037s-ed25519-eddsa-and-x25519-ecdh