Share via


KeyClient.GetCryptographyClient(String, String) Method

Definition

Get a CryptographyClient for the given key.

public virtual Azure.Security.KeyVault.Keys.Cryptography.CryptographyClient GetCryptographyClient (string keyName, string keyVersion = default);
abstract member GetCryptographyClient : string * string -> Azure.Security.KeyVault.Keys.Cryptography.CryptographyClient
override this.GetCryptographyClient : string * string -> Azure.Security.KeyVault.Keys.Cryptography.CryptographyClient
Public Overridable Function GetCryptographyClient (keyName As String, Optional keyVersion As String = Nothing) As CryptographyClient

Parameters

keyName
String

The name of the key used to perform cryptographic operations.

keyVersion
String

Optional version of the key used to perform cryptographic operations.

Returns

A CryptographyClient using the same options and pipeline as this KeyClient.

Exceptions

keyName is an empty string.

keyName is null.

Remarks

Given a key keyName and optional keyVersion, a new CryptographyClient will be created using the same VaultUri and options passed to this KeyClient, including the KeyClientOptions.ServiceVersion, Diagnostics, Retry, and other options.

If you want to create a CryptographyClient using a different Key Vault or Managed HSM endpoint, with different options, or even with a JsonWebKey you already have acquired, you can create a CryptographyClient directly with any of those alternatives.

Applies to