Skip to content

the requested hash function is unavailable #288

@tonyqui

Description

@tonyqui

Greeting folks,
I am currently trying to perform the validation of a JWT token issued by AzureActiveDirectory.

Here's the header:

{ "typ":"JWT", "nonce":"fF8GUtxqSoRupyeXtb-7Azd1VC9y0zmaV9HpBE2r4_w", "alg":"RS256", "x5t":"-KI3Q9nNR7bRofxmeZoXqbHZGew", "kid":"-KI3Q9nNR7bRofxmeZoXqbHZGew"}

I can find the corresponding certificate using the following API:
https://login.microsoftonline.com/common/discovery/keys

I'm trying to call Validate method through:

test := &jwt.SigningMethodRSA{}
err = test.Verify(signstring, signature, &publickey)
where:

  • signstring is the base64urldecoded version of JWS payload
  • signature is the JWS Signature retrieved from JWT token
  • publickey is a *rsa.PublicKey representing the public key (I attempted to extract it from certificate through jwt.Parse and creating directly a new structure from modulus and exponent found in previous Azure api call).

At the time of the execution, Verify method returns an error:
the requested hash function is unavailable
I am not sure if this is linked to any pre-requisite not met or to any other mis-configuration of RSA hash.

Any clue about what I should be checking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions