Udostępnij za pośrednictwem


CryptographyClient.WrapKeyAsync Method

Definition

Encrypts the specified key.

public virtual System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.WrapResult> WrapKeyAsync (Azure.Security.KeyVault.Keys.Cryptography.KeyWrapAlgorithm algorithm, byte[] key, System.Threading.CancellationToken cancellationToken = default);
abstract member WrapKeyAsync : Azure.Security.KeyVault.Keys.Cryptography.KeyWrapAlgorithm * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.WrapResult>
override this.WrapKeyAsync : Azure.Security.KeyVault.Keys.Cryptography.KeyWrapAlgorithm * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.WrapResult>
Public Overridable Function WrapKeyAsync (algorithm As KeyWrapAlgorithm, key As Byte(), Optional cancellationToken As CancellationToken = Nothing) As Task(Of WrapResult)

Parameters

algorithm
KeyWrapAlgorithm

The KeyWrapAlgorithm to use.

key
Byte[]

The key to encrypt.

cancellationToken
CancellationToken

A CancellationToken to cancel the operation.

Returns

The result of the wrap operation. The returned WrapResult contains the wrapped key along with all other information needed to unwrap it. This information should be stored with the wrapped key.

Exceptions

The specified algorithm does not match the key corresponding to the key identifier.

The local cryptographic provider threw an exception.

The key is invalid for the current operation.

The operation is not supported with the specified key.

The server returned an error. See Message for details returned from the server.

Applies to