Share via


JsonWebTokenHandler.DecryptToken Method

Definition

Decrypts a JWE and returns the clear text

public string DecryptToken (Microsoft.IdentityModel.JsonWebTokens.JsonWebToken jwtToken, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters);
member this.DecryptToken : Microsoft.IdentityModel.JsonWebTokens.JsonWebToken * Microsoft.IdentityModel.Tokens.TokenValidationParameters -> string
Public Function DecryptToken (jwtToken As JsonWebToken, validationParameters As TokenValidationParameters) As String

Parameters

jwtToken
JsonWebToken

the JWE that contains the cypher text.

validationParameters
TokenValidationParameters

contains crypto material.

Returns

the decoded / cleartext contents of the JWE.

Exceptions

if validationParameters is null.

if 'jwtToken .Enc' is null or empty.

if 'jwtToken .Kid' is not null AND decryption fails.

if the JWE was not able to be decrypted.

Applies to