JsonWebTokenHandler.EncryptToken Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
if additionalHeaderClaims
is null or empty.
if both CryptoProviderFactory and Key.CryptoProviderFactory are null.
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).
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
if algorithm
is null or empty.
if both CryptoProviderFactory and Key.CryptoProviderFactory are null.
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).
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
if encryptingCredentials
is null.
if both CryptoProviderFactory and Key.CryptoProviderFactory are null.
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
if additionalHeaderClaims
is null.
if both CryptoProviderFactory and Key.CryptoProviderFactory are null.
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
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de