val jwtConsumer = JwtConsumerBuilder()
.setVerificationKey(getPublicKeyFromPEMString(publicKeyAuth)) // verify the signature with the public key
.setRelaxVerificationKeyValidation() // needed if the key is smaller than 256 bits
.setJwsAlgorithmConstraints( // only allow the expected signature algorithm(s) in the given context
AlgorithmConstraints.ConstraintType.PERMIT,
AlgorithmIdentifiers.ECDSA_USING_P256_CURVE_AND_SHA256
)
.build()
I am using jose4j 0.7.9 for verification.
where, I created a JWT with ES256 header and secp256k1 curve key using fusionAuth library. So while validating the jwt with the public key in key pair.
It gets successful only when this flag (setRelaxVerificationKeyValidation) value is set to false.
Can anyone please tell me, what relaxation it is doing? I tried with a wrong key to test, but it failed as expected. Please shed some light.