Share via


AuthenticatedEncryptionProvider.GetKeyBytes(SecurityKey) Method

Definition

Called to obtain the byte[] needed to create a KeyedHashAlgorithm.

protected virtual byte[] GetKeyBytes (Microsoft.IdentityModel.Tokens.SecurityKey key);
abstract member GetKeyBytes : Microsoft.IdentityModel.Tokens.SecurityKey -> byte[]
override this.GetKeyBytes : Microsoft.IdentityModel.Tokens.SecurityKey -> byte[]
Protected Overridable Function GetKeyBytes (key As SecurityKey) As Byte()

Parameters

key
SecurityKey

The SecurityKey that will be used to obtain the byte[].

Returns

Byte[]

Byte[] that is used to populated the KeyedHashAlgorithm.

Exceptions

Thrown if key is null.

Thrown if a byte[] can not be obtained from SecurityKey.

Remarks

SymmetricSecurityKey and JsonWebKey are supported.

For a SymmetricSecurityKey, Key is returned

For a JsonWebKey, DecodeBytes(String) is called with K if Kty == JsonWebAlgorithmsKeyTypes.Octet.

Applies to