Skip to content

JWKError when using a JWKS with multiple algorithms #138

@piedrahitapablo

Description

@piedrahitapablo

Hi, again, I'm not sure if this is expected behavior or a bug, but currently I'm in a situation where a JWT needs to be decoded and it can be encoded using RS256 or HS256, so my JWKS has 3 JWK, 2 for RS256 and 1 for HS256.

In this case, if I use a JWT encoded with HS256 and the first JWK in my JWKS has kty: 'RSA' a JWKError("Incorrect key type. Expected: 'oct', Recieved: RSA",) is raised, if the conditions are reversed, JWT encoded with RS256 and the first JWK having kty: 'oct', JWKError("Incorrect key type. Expected: 'RSA', Recieved: oct",) is raised. I think the troubling line is https://github.com/mpdavis/python-jose/blob/master/jose/jws.py#L216 as it attempts to construct a JWK using the wrong algorithm.

Thanks for developing this library and if I can be of any use to solve this (if it's a bug) let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions