JsonWebTokenHandler.EncryptToken Method

Definition

Overloads

EncryptToken(String, EncryptingCredentials, String, IDictionary<String,Object>)

Encrypts a JWS.

EncryptToken(String, EncryptingCredentials, String)

Encrypts a JWS.

EncryptToken(String, EncryptingCredentials)

Encrypts a JWS.

EncryptToken(String, EncryptingCredentials, IDictionary<String,Object>)

Encrypts a JWS.

EncryptToken(String, EncryptingCredentials, String, IDictionary<String,Object>)

Encrypts a JWS.

public string EncryptToken (string innerJwt, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials, string algorithm, System.Collections.Generic.IDictionary<string,object> additionalHeaderClaims);
member this.EncryptToken : string * Microsoft.IdentityModel.Tokens.EncryptingCredentials * string * System.Collections.Generic.IDictionary<string, obj> -> string
Public Function EncryptToken (innerJwt As String, encryptingCredentials As EncryptingCredentials, algorithm As String, additionalHeaderClaims As IDictionary(Of String, Object)) As String

Parameters

innerJwt
String

A JSON Web Token (JWT) in JWS Compact Serialization format.

encryptingCredentials
EncryptingCredentials

Defines the security key and algorithm that will be used to encrypt the innerJwt.

algorithm
String

Defines the compression algorithm that will be used to compress the innerJwt

additionalHeaderClaims
IDictionary<String,Object>

Defines the dictionary containing any custom header claims that need to be added to the outer JWT token header.

Returns

Exceptions

Thrown if additionalHeaderClaims is null or empty.

Thrown if both CryptoProviderFactory and Key are null.

Thrown if not using one of the supported content encryption key (CEK) algorithms: 128, 384 or 512 AesCbcHmac (this applies in the case of key wrap only, not direct encryption).

Thrown if compression using 'algorithm' fails.

Applies to

EncryptToken(String, EncryptingCredentials, String)

Encrypts a JWS.

public string EncryptToken (string innerJwt, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials, string algorithm);
member this.EncryptToken : string * Microsoft.IdentityModel.Tokens.EncryptingCredentials * string -> string
Public Function EncryptToken (innerJwt As String, encryptingCredentials As EncryptingCredentials, algorithm As String) As String

Parameters

innerJwt
String

A JSON Web Token (JWT) in JWS Compact Serialization format.

encryptingCredentials
EncryptingCredentials

Defines the security key and algorithm that will be used to encrypt the innerJwt.

algorithm
String

Defines the compression algorithm that will be used to compress the innerJwt.

Returns

Exceptions

Thrown if algorithm is null or empty.

Thrown if both CryptoProviderFactory and Key are null.

Thrown if not using one of the supported content encryption key (CEK) algorithms: 128, 384 or 512 AesCbcHmac (this applies in the case of key wrap only, not direct encryption).

Thrown if compression using algorithm fails.

Applies to

EncryptToken(String, EncryptingCredentials)

Encrypts a JWS.

public string EncryptToken (string innerJwt, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials);
member this.EncryptToken : string * Microsoft.IdentityModel.Tokens.EncryptingCredentials -> string
Public Function EncryptToken (innerJwt As String, encryptingCredentials As EncryptingCredentials) As String

Parameters

innerJwt
String

A JSON Web Token (JWT) in JWS Compact Serialization format.

encryptingCredentials
EncryptingCredentials

Defines the security key and algorithm that will be used to encrypt the innerJwt.

Returns

Exceptions

Thrown if encryptingCredentials is null.

Thrown if both CryptoProviderFactory and Key are null.

Thrown if not using one of the supported content encryption key (CEK) algorithms: 128, 384 or 512 AesCbcHmac (this applies in the case of key wrap only, not direct encryption).

Applies to

EncryptToken(String, EncryptingCredentials, IDictionary<String,Object>)

Encrypts a JWS.

public string EncryptToken (string innerJwt, Microsoft.IdentityModel.Tokens.EncryptingCredentials encryptingCredentials, System.Collections.Generic.IDictionary<string,object> additionalHeaderClaims);
member this.EncryptToken : string * Microsoft.IdentityModel.Tokens.EncryptingCredentials * System.Collections.Generic.IDictionary<string, obj> -> string
Public Function EncryptToken (innerJwt As String, encryptingCredentials As EncryptingCredentials, additionalHeaderClaims As IDictionary(Of String, Object)) As String

Parameters

innerJwt
String

A JSON Web Token (JWT) in JWS Compact Serialization format.

encryptingCredentials
EncryptingCredentials

Defines the security key and algorithm that will be used to encrypt the innerJwt.

additionalHeaderClaims
IDictionary<String,Object>

Defines the dictionary containing any custom header claims that need to be added to the outer JWT token header.

Returns

Exceptions

Thrown if additionalHeaderClaims is null.

Thrown if both CryptoProviderFactory and Key are null.

Thrown if not using one of the supported content encryption key (CEK) algorithms: 128, 384 or 512 AesCbcHmac (this applies in the case of key wrap only, not direct encryption).

Applies to