Use of JWS may suffer from flaws when relying on the "alg"
attribute as described here: Critical vulnerabilities in JSON Web Token libraries.
The advice is to verify that the signing JWS algorithm is in a list of accepted algorithms. Practically, most JWS libraries have added am "alg"
whitelist parameter:
verify(string token, string algorithm, string verificationKey)
They haven't, however, added such a parameter for JWE decryption.
When proceeding with JWE decryption, should I verify after successful decryption that the "alg"
and "enc"
are in a whitelist of acceptable values? In other words, does JWE decryption suffers the same problems than JWS signature verification?