Support for JWSAlgorithm.Family.ED to JWKMatcher

Issue #323 resolved
Former user created an issue

Hi, It seems like the JWKMatcher lacks support for JWSAlgorithm.Family.ED.

Is this something that will be supported in the future?

Thanks!

Comments (4)

  1. Ben Arena

    I would be happy to submit a PR for this trivial change, but I lack permissions to do so and there are no instructions on your Report bugs and contribute page.

    If someone with permissions wants to pick this up it may be as simple as this:

    JWKMatcher.java:1039

            } else if (JWSAlgorithm.Family.ED.contains(algorithm)) {
                return new JWKMatcher.Builder()
                    .keyType(KeyType.forAlgorithm(algorithm))
                    .keyID(jwsHeader.getKeyID())
                    .keyUses(KeyUse.SIGNATURE, null)
                    .algorithms(algorithm, null)
                    .curves(Curve.forJWSAlgorithm(algorithm))
                    .build();
    

    JWKMatcherTest,java

        public void testMatchEdDSAJWSHeader() {
            OctetKeyPair okp = new OctetKeyPair.Builder(Curve.Ed25519, new Base64URL("x"))
                .algorithm(JWSAlgorithm.EdDSA)
                .keyID("Dave")
                .build();
    
            JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.EdDSA)
                .keyID("Dave")
                .jwk(okp)
                .build();
    
            assertTrue(JWKMatcher.forJWSHeader(header).matches(okp));
        }
    

  2. Log in to comment