azure-docs-sdk-java/docs-ref-autogen/com.azure.security.keyvault...

769 строки
189 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.security.keyvault.keys.KeyClient"
fullName: "com.azure.security.keyvault.keys.KeyClient"
name: "KeyClient"
nameWithType: "KeyClient"
summary: "The <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> provides synchronous methods to manage <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the Azure Key Vault."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **KeyClient**"
methods:
- uid: "com.azure.security.keyvault.keys.KeyClient.backupKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.backupKey(String name)"
name: "backupKey(String name)"
nameWithType: "KeyClient.backupKey(String name)"
summary: "Requests a backup of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> be downloaded to the client."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public byte[] backupKey(String name)"
desc: "Requests a backup of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> be downloaded to the client. The key backup operation exports a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> from Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in one Azure Key Vault instance, backup the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, and then restore it into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> from Azure Key Vault. Individual versions of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> cannot be backed up. `Backup/Restore` can be performed within geographical boundaries only; meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the `key/backup` permission.\n\n**Code Samples**\n\nBacks up the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> from the key vault.\n\n```java\nbyte[] keyBackup = keyClient.backupKey(\"keyName\");\n\n System.out.printf(\"Key backup byte array length: %s%n\", keyBackup.length);\n```"
returns:
description: "The backed up key blob."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- uid: "com.azure.security.keyvault.keys.KeyClient.backupKeyWithResponse(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.backupKeyWithResponse(String name, Context context)"
name: "backupKeyWithResponse(String name, Context context)"
nameWithType: "KeyClient.backupKeyWithResponse(String name, Context context)"
summary: "Requests a backup of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> be downloaded to the client."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<byte[]> backupKeyWithResponse(String name, Context context)"
desc: "Requests a backup of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> be downloaded to the client. The key backup operation exports a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> from Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in one Azure Key Vault instance, backup the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, and then restore it into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> from Azure Key Vault. Individual versions of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> cannot be backed up. `Backup/Restore` can be performed within geographical boundaries only; meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored in an EU geographical area. This operation requires the `key/backup` permission.\n\n**Code Samples**\n\nBacks up the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> from the key vault and prints out the length of the key's backup byte array returned in the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTPresponse\"></xref>.\n\n```java\nResponse<byte[]> backupKeyResponse = keyClient.backupKeyWithResponse(\"keyName\", new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Key backup byte array length: %s%n\", backupKeyResponse.getValue().length);\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the backed up key blob."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.beginDeleteKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.beginDeleteKey(String name)"
name: "beginDeleteKey(String name)"
nameWithType: "KeyClient.beginDeleteKey(String name)"
summary: "Deletes a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of any type from the key vault."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to be deleted."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<DeletedKey,Void> beginDeleteKey(String name)"
desc: "Deletes a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of any type from the key vault. If soft-delete is enabled on the key vault then the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is placed in the deleted state and requires to be purged for permanent deletion else the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is permanently deleted. The delete operation applies to any <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> stored in Azure Key Vault but it cannot be applied to an individual version of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. This operation removes the cryptographic material associated with the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, which means the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is not usable for `Sign/Verify`, `Wrap/Unwrap` or `Encrypt/Decrypt` operations. This operation requires the `keys/delete` permission.\n\n**Code Samples**\n\nDeletes the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> from the key vault. Prints out the recovery id of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>.\n\n```java\nSyncPoller<DeletedKey, Void> deleteKeyPoller = keyClient.beginDeleteKey(\"keyName\");\n PollResponse<DeletedKey> deleteKeyPollResponse = deleteKeyPoller.poll();\n\n // Deleted date only works for SoftDelete Enabled Key Vault.\n DeletedKey deletedKey = deleteKeyPollResponse.getValue();\n\n System.out.printf(\"Key delete date: %s%n\", deletedKey.getDeletedOn());\n System.out.printf(\"Deleted key's recovery id: %s%n\", deletedKey.getRecoveryId());\n\n // Key is being deleted on the server.\n deleteKeyPoller.waitForCompletion();\n // Key is deleted\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll on and retrieve <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>"
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.DeletedKey?alt=com.azure.security.keyvault.keys.models.DeletedKey&text=DeletedKey\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.beginRecoverDeletedKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.beginRecoverDeletedKey(String name)"
name: "beginRecoverDeletedKey(String name)"
nameWithType: "KeyClient.beginRecoverDeletedKey(String name)"
summary: "Recovers the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> in the key vault to its latest version and can only be performed on a soft-delete enabled vault."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> to be recovered."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<KeyVaultKey,Void> beginRecoverDeletedKey(String name)"
desc: "Recovers the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt to recover an <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"non-deleted key\"></xref> will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the `keys/recover` permission.\n\n**Code Samples**\n\nRecovers the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> from the key vault enabled for soft-delete.\n\n```java\nSyncPoller<KeyVaultKey, Void> recoverKeyPoller = keyClient.beginRecoverDeletedKey(\"deletedKeyName\");\n\n PollResponse<KeyVaultKey> recoverKeyPollResponse = recoverKeyPoller.poll();\n\n KeyVaultKey recoveredKey = recoverKeyPollResponse.getValue();\n System.out.printf(\"Recovered key name: %s%n\", recoveredKey.getName());\n System.out.printf(\"Recovered key id: %s%n\", recoveredKey.getId());\n\n // Key is being recovered on the server.\n recoverKeyPoller.waitForCompletion();\n // Key is recovered\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll on and retrieve <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"recovered key\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.createEcKey(com.azure.security.keyvault.keys.models.CreateEcKeyOptions)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createEcKey(CreateEcKeyOptions createEcKeyOptions)"
name: "createEcKey(CreateEcKeyOptions createEcKeyOptions)"
nameWithType: "KeyClient.createEcKey(CreateEcKeyOptions createEcKeyOptions)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> being created."
name: "createEcKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateEcKeyOptions&text=CreateEcKeyOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey createEcKey(CreateEcKeyOptions createEcKeyOptions)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> and stores it in the key vault. The create EC key operation can be used to create any EC <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateEcKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getCurveName()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key curve\"></xref> can be optionally specified. If not specified, the default value <xref uid=\"com.azure.security.keyvault.keys.models.KeyCurveName.P_256\" data-throw-if-not-resolved=\"false\" data-raw-source=\"P-256\"></xref> is used by Azure Key Vault. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyVaultKey\"></xref> key to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> with a <xref uid=\"com.azure.security.keyvault.keys.models.KeyCurveName.P_384\" data-throw-if-not-resolved=\"false\" data-raw-source=\"P-384\"></xref> web key curve. The key activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateEcKeyOptions createEcKeyOptions = new CreateEcKeyOptions(\"keyName\")\n .setCurveName(KeyCurveName.P_384)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n KeyVaultKey ecKey = keyClient.createEcKey(createEcKeyOptions);\n\n System.out.printf(\"Created key with name: %s and id: %s%n\", ecKey.getName(), ecKey.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.createEcKeyWithResponse(com.azure.security.keyvault.keys.models.CreateEcKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createEcKeyWithResponse(CreateEcKeyOptions createEcKeyOptions, Context context)"
name: "createEcKeyWithResponse(CreateEcKeyOptions createEcKeyOptions, Context context)"
nameWithType: "KeyClient.createEcKeyWithResponse(CreateEcKeyOptions createEcKeyOptions, Context context)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> being created."
name: "createEcKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateEcKeyOptions&text=CreateEcKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> createEcKeyWithResponse(CreateEcKeyOptions createEcKeyOptions, Context context)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> and stores it in the key vault. The create EC key operation can be used to create any EC <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateEcKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getCurveName()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key curve\"></xref> can be optionally specified. If not specified, the default value <xref uid=\"com.azure.security.keyvault.keys.models.KeyCurveName.P_256\" data-throw-if-not-resolved=\"false\" data-raw-source=\"P-256\"></xref> is used by Azure Key Vault. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateEcKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyVaultKey\"></xref> key to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref> with a <xref uid=\"com.azure.security.keyvault.keys.models.KeyCurveName.P_384\" data-throw-if-not-resolved=\"false\" data-raw-source=\"P-384\"></xref> web key curve. The key activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateEcKeyOptions createEcKeyOptions = new CreateEcKeyOptions(\"keyName\")\n .setCurveName(KeyCurveName.P_384)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n Response<KeyVaultKey> createEcKeyResponse =\n keyClient.createEcKeyWithResponse(createEcKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Created key with name: %s and: id %s%n\", createEcKeyResponse.getValue().getName(),\n createEcKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.createKey(com.azure.security.keyvault.keys.models.CreateKeyOptions)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createKey(CreateKeyOptions createKeyOptions)"
name: "createKey(CreateKeyOptions createKeyOptions)"
nameWithType: "KeyClient.createKey(CreateKeyOptions createKeyOptions)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> being created."
name: "createKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateKeyOptions&text=CreateKeyOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey createKey(CreateKeyOptions createKeyOptions)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The create key operation can be used to create any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getExpiresOn()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getNotBefore()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.isEnabled()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateKeyOptions#isEnabled()\"></xref> enabled\\} field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getKeyType()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT\"></xref>, and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> which activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateKeyOptions createKeyOptions = new CreateKeyOptions(\"keyName\", KeyType.RSA)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n KeyVaultKey optionsKey = keyClient.createKey(createKeyOptions);\n\n System.out.printf(\"Created key with name: %s and id: %s%n\", optionsKey.getName(), optionsKey.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.createKey(java.lang.String,com.azure.security.keyvault.keys.models.KeyType)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createKey(String name, KeyType keyType)"
name: "createKey(String name, KeyType keyType)"
nameWithType: "KeyClient.createKey(String name, KeyType keyType)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> being created."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. For valid values, see <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyType\"></xref>."
name: "keyType"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyType?alt=com.azure.security.keyvault.keys.models.KeyType&text=KeyType\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey createKey(String name, KeyType keyType)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The create key operation can be used to create any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT\"></xref>, and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC key\"></xref>. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nKeyVaultKey key = keyClient.createKey(\"keyName\", KeyType.EC);\n System.out.printf(\"Created key with name: %s and id: %s%n\", key.getName(), key.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.createKeyWithResponse(com.azure.security.keyvault.keys.models.CreateKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context)"
name: "createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context)"
nameWithType: "KeyClient.createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> being created."
name: "createKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateKeyOptions&text=CreateKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The create key operation can be used to create any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getExpiresOn()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getNotBefore()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.isEnabled()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateKeyOptions.getKeyType()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.EC_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EC-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA-HSM\"></xref>, <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT\"></xref>, and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> which activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateKeyOptions createKeyOptions = new CreateKeyOptions(\"keyName\", KeyType.RSA)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n Response<KeyVaultKey> createKeyResponse =\n keyClient.createKeyWithResponse(createKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Created key with name: %s and: id %s%n\", createKeyResponse.getValue().getName(),\n createKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.createOctKey(com.azure.security.keyvault.keys.models.CreateOctKeyOptions)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createOctKey(CreateOctKeyOptions createOctKeyOptions)"
name: "createOctKey(CreateOctKeyOptions createOctKeyOptions)"
nameWithType: "KeyClient.createOctKey(CreateOctKeyOptions createOctKeyOptions)"
summary: "Creates and stores a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> being created."
name: "createOctKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateOctKeyOptions&text=CreateOctKeyOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey createOctKey(CreateOctKeyOptions createOctKeyOptions)"
desc: "Creates and stores a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> in the key vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the key. This operation requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateOctKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyVaultKey\"></xref> key to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref>. The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> activates in one day and expires in one year. Prints out the details of the newly <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateOctKeyOptions createOctKeyOptions = new CreateOctKeyOptions(\"keyName\")\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n KeyVaultKey octKey = keyClient.createOctKey(createOctKeyOptions);\n\n System.out.printf(\"Created key with name: %s and id: %s%n\", octKey.getName(), octKey.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.createOctKeyWithResponse(com.azure.security.keyvault.keys.models.CreateOctKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createOctKeyWithResponse(CreateOctKeyOptions createOctKeyOptions, Context context)"
name: "createOctKeyWithResponse(CreateOctKeyOptions createOctKeyOptions, Context context)"
nameWithType: "KeyClient.createOctKeyWithResponse(CreateOctKeyOptions createOctKeyOptions, Context context)"
summary: "Creates and stores a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> being created."
name: "createOctKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateOctKeyOptions&text=CreateOctKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> createOctKeyWithResponse(CreateOctKeyOptions createOctKeyOptions, Context context)"
desc: "Creates and stores a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref> in the key vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the key. This operation requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateOctKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateOctKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyVaultKey\"></xref> key to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.OCT_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OCT-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"symmetric key\"></xref>. The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> activates in one day and expires in one year. Prints out the details of the newly <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateOctKeyOptions createOctKeyOptions = new CreateOctKeyOptions(\"keyName\")\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n Response<KeyVaultKey> createOctKeyResponse =\n keyClient.createOctKeyWithResponse(createOctKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Created key with name: %s and: id %s%n\", createOctKeyResponse.getValue().getName(),\n createOctKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.createRsaKey(com.azure.security.keyvault.keys.models.CreateRsaKeyOptions)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createRsaKey(CreateRsaKeyOptions createRsaKeyOptions)"
name: "createRsaKey(CreateRsaKeyOptions createRsaKeyOptions)"
nameWithType: "KeyClient.createRsaKey(CreateRsaKeyOptions createRsaKeyOptions)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> being created."
name: "createRsaKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateRsaKeyOptions&text=CreateRsaKeyOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey createRsaKey(CreateRsaKeyOptions createRsaKeyOptions)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> and stores it in the key vault. The create RSA key operation can be used to create any RSA key type in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateRsaKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getKeySize()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keySize\"></xref> can be optionally specified. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> with size 2048 which activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(\"keyName\")\n .setKeySize(2048)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n KeyVaultKey rsaKey = keyClient.createRsaKey(createRsaKeyOptions);\n\n System.out.printf(\"Created key with name: %s and id: %s%n\", rsaKey.getName(), rsaKey.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.createRsaKeyWithResponse(com.azure.security.keyvault.keys.models.CreateRsaKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.createRsaKeyWithResponse(CreateRsaKeyOptions createRsaKeyOptions, Context context)"
name: "createRsaKeyWithResponse(CreateRsaKeyOptions createRsaKeyOptions, Context context)"
nameWithType: "KeyClient.createRsaKeyWithResponse(CreateRsaKeyOptions createRsaKeyOptions, Context context)"
summary: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> being created."
name: "createRsaKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions?alt=com.azure.security.keyvault.keys.models.CreateRsaKeyOptions&text=CreateRsaKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> createRsaKeyWithResponse(CreateRsaKeyOptions createRsaKeyOptions, Context context)"
desc: "Creates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> and stores it in the key vault. The create RSA key operation can be used to create any RSA key type in Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. It requires the `keys/create` permission.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CreateRsaKeyOptions\"></xref> parameter is required. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getKeySize()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keySize\"></xref> can be optionally specified. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values are optional. The <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` by Azure Key Vault, if not specified.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.CreateRsaKeyOptions.getKeyType*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keyType\"></xref> indicates the type of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to create. Possible values include: <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyType.RSA_HSM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA-HSM\"></xref>.\n\n**Code Samples**\n\nCreates a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RSA key\"></xref> with size 2048 which activates in one day and expires in one year. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>.\n\n```java\nCreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(\"keyName\")\n .setKeySize(2048)\n .setNotBefore(OffsetDateTime.now().plusDays(1))\n .setExpiresOn(OffsetDateTime.now().plusYears(1));\n Response<KeyVaultKey> createRsaKeyResponse =\n keyClient.createRsaKeyWithResponse(createRsaKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Created key with name: %s and: id %s%n\", createRsaKeyResponse.getValue().getName(),\n createRsaKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"created key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.getCryptographyClient(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getCryptographyClient(String keyName)"
name: "getCryptographyClient(String keyName)"
nameWithType: "KeyClient.getCryptographyClient(String keyName)"
summary: "Creates a <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> for the latest version of a given key."
parameters:
- description: "The name of the key."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public CryptographyClient getCryptographyClient(String keyName)"
desc: "Creates a <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> for the latest version of a given key.\n\nTo ensure correct behavior when performing operations such as `Decrypt`, `Unwrap` and `Verify`, it is recommended to use a <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> created for the specific key version that was used for the corresponding inverse operation: `Encrypt`, `Wrap`, or `Sign`, respectively.\n\nYou can provide a key version either via <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getCryptographyClient(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getCryptographyClient(String, String)\"></xref> or by ensuring it is included in the `keyIdentifier` passed to <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder.keyIdentifier(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClientBuilder#keyIdentifier(String)\"></xref> before building a client."
returns:
description: "An instance of <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> associated with the latest version of a key with the\n provided name."
type: "<xref href=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient?alt=com.azure.security.keyvault.keys.cryptography.CryptographyClient&text=CryptographyClient\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getCryptographyClient(java.lang.String,java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getCryptographyClient(String keyName, String keyVersion)"
name: "getCryptographyClient(String keyName, String keyVersion)"
nameWithType: "KeyClient.getCryptographyClient(String keyName, String keyVersion)"
summary: "Creates a <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> for a given key version."
parameters:
- description: "The name of the key."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The key version."
name: "keyVersion"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public CryptographyClient getCryptographyClient(String keyName, String keyVersion)"
desc: "Creates a <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> for a given key version."
returns:
description: "An instance of <xref uid=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CryptographyClient\"></xref> associated with a key with the provided name and version.\n If <code>keyVersion</code> is <code>null</code> or empty, the client will use the latest version of the key."
type: "<xref href=\"com.azure.security.keyvault.keys.cryptography.CryptographyClient?alt=com.azure.security.keyvault.keys.cryptography.CryptographyClient&text=CryptographyClient\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getDeletedKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getDeletedKey(String name)"
name: "getDeletedKey(String name)"
nameWithType: "KeyClient.getDeletedKey(String name)"
summary: "Gets the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
parameters:
- description: "The name of the deleted <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public DeletedKey getDeletedKey(String name)"
desc: "Gets the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>. The get deleted Key operation is applicable for soft-delete enabled vaults. This operation requires the `keys/get` permission.\n\n**Code Samples**\n\nGets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> from the key vault enabled for soft-delete. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>.\n\n```java\nDeletedKey deletedKey = keyClient.getDeletedKey(\"keyName\");\n\n System.out.printf(\"Deleted key's recovery id: %s%n\", deletedKey.getRecoveryId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.DeletedKey?alt=com.azure.security.keyvault.keys.models.DeletedKey&text=DeletedKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getDeletedKeyWithResponse(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getDeletedKeyWithResponse(String name, Context context)"
name: "getDeletedKeyWithResponse(String name, Context context)"
nameWithType: "KeyClient.getDeletedKeyWithResponse(String name, Context context)"
summary: "Gets the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
parameters:
- description: "The name of the deleted <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<DeletedKey> getDeletedKeyWithResponse(String name, Context context)"
desc: "Gets the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>. The get deleted Key operation is applicable for soft-delete enabled vaults. This operation requires the `keys/get` permission.\n\n**Code Samples**\n\nGets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> from the key vault enabled for soft-delete. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> returned in the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTPresponse\"></xref>.\n\n```java\nResponse<DeletedKey> deletedKeyResponse =\n keyClient.getDeletedKeyWithResponse(\"keyName\", new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Deleted key with recovery id: %s%n\", deletedKeyResponse.getValue().getRecoveryId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.DeletedKey?alt=com.azure.security.keyvault.keys.models.DeletedKey&text=DeletedKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getKey(String name)"
name: "getKey(String name)"
nameWithType: "KeyClient.getKey(String name)"
summary: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, cannot be <code>null</code>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public KeyVaultKey getKey(String name)"
desc: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version. The get key operation is applicable to all <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key types\"></xref> and it requires the `keys/get` permission.\n\n**Code Samples**\n\nGets a specific version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"retrieved key\"></xref>.\n\n```java\nKeyVaultKey keyWithVersionValue = keyClient.getKey(\"keyName\");\n\n System.out.printf(\"Retrieved key with name: %s and: id %s%n\", keyWithVersionValue.getName(),\n keyWithVersionValue.getId());\n```"
returns:
description: "The requested <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The content of the key is <code>null</code> if <code>name</code> is\n <code>null</code> or empty."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getKey(String name, String version)"
name: "getKey(String name, String version)"
nameWithType: "KeyClient.getKey(String name, String version)"
summary: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, cannot be <code>null</code>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to retrieve. If this is an empty string or\n <code>null</code>, this call is equivalent to calling <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String)\"></xref>, with the latest version\n being retrieved."
name: "version"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public KeyVaultKey getKey(String name, String version)"
desc: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version. The get key operation is applicable to all <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key types\"></xref> and it requires the `keys/get` permission.\n\n**Code Samples**\n\nGets a specific version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"retrieved key\"></xref>.\n\n```java\nString keyVersion = \"6A385B124DEF4096AF1361A85B16C204\";\n KeyVaultKey keyWithVersion = keyClient.getKey(\"keyName\", keyVersion);\n\n System.out.printf(\"Retrieved key with name: %s and: id %s%n\", keyWithVersion.getName(),\n keyWithVersion.getId());\n```"
returns:
description: "The requested <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The content of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is <code>null</code> if\n both <code>name</code> and <code>version</code> are <code>null</code> or empty."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getKeyRotationPolicy(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getKeyRotationPolicy(String keyName)"
name: "getKeyRotationPolicy(String keyName)"
nameWithType: "KeyClient.getKeyRotationPolicy(String keyName)"
summary: "Gets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public KeyRotationPolicy getKeyRotationPolicy(String keyName)"
desc: "Gets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name. This operation requires the `keys/get` permission.\n\n**Code Samples**\n\nRetrieves the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy\"></xref> of a given <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy key\"></xref> details.\n\n```java\nKeyRotationPolicy keyRotationPolicy = keyClient.getKeyRotationPolicy(\"keyName\");\n\n System.out.printf(\"Retrieved key rotation policy with id: %s%n\", keyRotationPolicy.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.getKeyRotationPolicyWithResponse(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getKeyRotationPolicyWithResponse(String keyName, Context context)"
name: "getKeyRotationPolicyWithResponse(String keyName, Context context)"
nameWithType: "KeyClient.getKeyRotationPolicyWithResponse(String keyName, Context context)"
summary: "Gets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyRotationPolicy> getKeyRotationPolicyWithResponse(String keyName, Context context)"
desc: "Gets the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name. This operation requires the `keys/get` permission.\n\n**Code Samples**\n\nRetrieves the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy\"></xref> of a given <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP Response\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy key\"></xref> details.\n\n```java\nResponse<KeyRotationPolicy> keyRotationPolicyResponse =\n keyClient.getKeyRotationPolicyWithResponse(\"keyName\", new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Response received successfully with status code: %d. Retrieved key rotation policy\"\n + \"with id: %s%n\", keyRotationPolicyResponse.getStatusCode(), keyRotationPolicyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP response\"></xref> for this operation containing the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.getKeyWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getKeyWithResponse(String name, String version, Context context)"
name: "getKeyWithResponse(String name, String version, Context context)"
nameWithType: "KeyClient.getKeyWithResponse(String name, String version, Context context)"
summary: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, cannot be <code>null</code>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to retrieve. If this is an empty string or\n <code>null</code>, this call is equivalent to calling <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String)\"></xref>, with the latest version\n being retrieved."
name: "version"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> getKeyWithResponse(String name, String version, Context context)"
desc: "Gets the public part of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and key version. The get key operation is applicable to all <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key types\"></xref> and it requires the `keys/get` permission.\n\n**Code Samples**\n\nGets a specific version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"retrieved key\"></xref>.\n\n```java\nString keyVersion = \"6A385B124DEF4096AF1361A85B16C204\";\n Response<KeyVaultKey> getKeyResponse =\n keyClient.getKeyWithResponse(\"keyName\", keyVersion, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Retrieved key with name: %s and: id %s%n\", getKeyResponse.getValue().getName(),\n getKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the requested\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The content of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is <code>null</code> if both <code>name</code> and\n <code>version</code> are <code>null</code> or empty."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.getRandomBytes(int)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getRandomBytes(int count)"
name: "getRandomBytes(int count)"
nameWithType: "KeyClient.getRandomBytes(int count)"
summary: "Get the requested number of bytes containing random values from a managed HSM."
parameters:
- description: "The requested number of random bytes."
name: "count"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public byte[] getRandomBytes(int count)"
desc: "Get the requested number of bytes containing random values from a managed HSM.\n\n**Code Samples**\n\nGets a number of bytes containing random values from a Managed HSM. Prints out the retrieved bytes in base64Url format.\n\n```java\nint amount = 16;\n byte[] randomBytes = keyClient.getRandomBytes(amount);\n\n System.out.printf(\"Retrieved %d random bytes: %s%n\", amount, Arrays.toString(randomBytes));\n```"
returns:
description: "The requested number of bytes containing random values from a managed HSM."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- uid: "com.azure.security.keyvault.keys.KeyClient.getRandomBytesWithResponse(int,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.getRandomBytesWithResponse(int count, Context context)"
name: "getRandomBytesWithResponse(int count, Context context)"
nameWithType: "KeyClient.getRandomBytesWithResponse(int count, Context context)"
summary: "Get the requested number of bytes containing random values from a managed HSM."
parameters:
- description: "The requested number of random bytes."
name: "count"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<byte[]> getRandomBytesWithResponse(int count, Context context)"
desc: "Get the requested number of bytes containing random values from a managed HSM.\n\n**Code Samples**\n\nGets a number of bytes containing random values from a Managed HSM. Prints out the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP Response\"></xref> details and the retrieved bytes in base64Url format.\n\n```java\nint amountOfBytes = 16;\n Response<byte[]> response =\n keyClient.getRandomBytesWithResponse(amountOfBytes, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Response received successfully with status code: %d. Retrieved %d random bytes: %s%n\",\n response.getStatusCode(), amountOfBytes, Arrays.toString(response.getValue()));\n```"
returns:
description: "The <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP response\"></xref> for this operation and the requested number of bytes containing\n random values from a managed HSM."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.getVaultUrl()"
fullName: "com.azure.security.keyvault.keys.KeyClient.getVaultUrl()"
name: "getVaultUrl()"
nameWithType: "KeyClient.getVaultUrl()"
summary: "Get the vault endpoint url to which service requests are sent to."
syntax: "public String getVaultUrl()"
desc: "Get the vault endpoint url to which service requests are sent to."
returns:
description: "The vault endpoint url."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.security.keyvault.keys.KeyClient.importKey(com.azure.security.keyvault.keys.models.ImportKeyOptions)"
fullName: "com.azure.security.keyvault.keys.KeyClient.importKey(ImportKeyOptions importKeyOptions)"
name: "importKey(ImportKeyOptions importKeyOptions)"
nameWithType: "KeyClient.importKey(ImportKeyOptions importKeyOptions)"
summary: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> being imported."
name: "importKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.ImportKeyOptions?alt=com.azure.security.keyvault.keys.models.ImportKeyOptions&text=ImportKeyOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey importKey(ImportKeyOptions importKeyOptions)"
desc: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The import key operation may be used to import any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> into Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. This operation requires the `keys/import` permission.\n\n<xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ImportKeyOptions\"></xref> is required and its fields <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getName*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"name\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getKey()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key material\"></xref> cannot be `null`. The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values in `keyImportOptions` are optional. If not specified, no values are set for the fields. The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` and the <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.isHardwareProtected()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"hsm\"></xref> field is set to `false` by Azure Key Vault, if they are not specified.\n\n**Code Samples**\n\nImports a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> into the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>.\n\n```java\nImportKeyOptions options = new ImportKeyOptions(\"keyName\", jsonWebKeyToImport)\n .setHardwareProtected(false);\n KeyVaultKey importedKey = keyClient.importKey(options);\n\n System.out.printf(\"Imported key with name: %s and id: %s%n\", importedKey.getName(),\n importedKey.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.importKey(java.lang.String,com.azure.security.keyvault.keys.models.JsonWebKey)"
fullName: "com.azure.security.keyvault.keys.KeyClient.importKey(String name, JsonWebKey keyMaterial)"
name: "importKey(String name, JsonWebKey keyMaterial)"
nameWithType: "KeyClient.importKey(String name, JsonWebKey keyMaterial)"
summary: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The name for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> being imported."
name: "keyMaterial"
type: "<xref href=\"com.azure.security.keyvault.keys.models.JsonWebKey?alt=com.azure.security.keyvault.keys.models.JsonWebKey&text=JsonWebKey\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyVaultKey importKey(String name, JsonWebKey keyMaterial)"
desc: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The import key operation may be used to import any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> into Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. This operation requires the `keys/import` permission.\n\n**Code Samples**\n\nImports a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> into the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>.\n\n```java\nKeyVaultKey key = keyClient.importKey(\"keyName\", jsonWebKeyToImport);\n\n System.out.printf(\"Imported key with name: %s and id: %s%n\", key.getName(), key.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.importKeyWithResponse(com.azure.security.keyvault.keys.models.ImportKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.importKeyWithResponse(ImportKeyOptions importKeyOptions, Context context)"
name: "importKeyWithResponse(ImportKeyOptions importKeyOptions, Context context)"
nameWithType: "KeyClient.importKeyWithResponse(ImportKeyOptions importKeyOptions, Context context)"
summary: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options object\"></xref> containing information about the\n <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> being imported."
name: "importKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.ImportKeyOptions?alt=com.azure.security.keyvault.keys.models.ImportKeyOptions&text=ImportKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> importKeyWithResponse(ImportKeyOptions importKeyOptions, Context context)"
desc: "Imports an externally created <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and stores it in the key vault. The import key operation may be used to import any <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key type\"></xref> into Azure Key Vault. If a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name already exists, Azure Key Vault creates a new version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. This operation requires the `keys/import` permission.\n\n<xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ImportKeyOptions\"></xref> is required and its fields <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getName*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"name\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getKey()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key material\"></xref> cannot be `null`. The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getExpiresOn*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"expires\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.getNotBefore*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"notBefore\"></xref> values in `keyImportOptions` are optional. If not specified, no values are set for the fields. The <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.isEnabled*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"enabled\"></xref> field is set to `true` and the <xref uid=\"com.azure.security.keyvault.keys.models.ImportKeyOptions.isHardwareProtected()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"hsm\"></xref> field is set to `false` by Azure Key Vault, if they are not specified.\n\n**Code Samples**\n\nImports a new <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> into the key vault. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>.\n\n```java\nImportKeyOptions importKeyOptions = new ImportKeyOptions(\"keyName\", jsonWebKeyToImport)\n .setHardwareProtected(false);\n Response<KeyVaultKey> response =\n keyClient.importKeyWithResponse(importKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Imported key with name: %s and id: %s%n\", response.getValue().getName(),\n response.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"imported key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listDeletedKeys()"
fullName: "com.azure.security.keyvault.keys.KeyClient.listDeletedKeys()"
name: "listDeletedKeys()"
nameWithType: "KeyClient.listDeletedKeys()"
summary: "Lists <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> of the key vault."
syntax: "public PagedIterable<DeletedKey> listDeletedKeys()"
desc: "Lists <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> of the key vault. The <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> are retrieved as <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> structures that contain the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>. The get deleted keys operation is applicable for vaults enabled for soft-delete. This operation requires the `keys/list` permission.\n\n**Code Samples**\n\nLists the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> in the key vault and for each <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> prints out its recovery id.\n\n```java\nfor (DeletedKey deletedKey : keyClient.listDeletedKeys()) {\n System.out.printf(\"Deleted key's recovery id:%s%n\", deletedKey.getRecoveryId());\n }\n```\n\n**Code Samples to iterate over deleted keys by page**\n\nIterates over the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> by page in the key vault and for each deleted key prints out its recovery id.\n\n```java\nkeyClient.listDeletedKeys().iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(deletedKey ->\n System.out.printf(\"Deleted key's recovery id:%s%n\", deletedKey.getRecoveryId()));\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of all of the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> in the vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.DeletedKey?alt=com.azure.security.keyvault.keys.models.DeletedKey&text=DeletedKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listDeletedKeys(com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.listDeletedKeys(Context context)"
name: "listDeletedKeys(Context context)"
nameWithType: "KeyClient.listDeletedKeys(Context context)"
summary: "Lists <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> of the key vault."
parameters:
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public PagedIterable<DeletedKey> listDeletedKeys(Context context)"
desc: "Lists <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> of the key vault. The <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> are retrieved as <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> structures that contain the public part of a <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>. The get deleted keys operation is applicable for vaults enabled for soft-delete. This operation requires the `keys/list` permission.\n\n**Code Samples**\n\nLists the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> in the key vault and for each <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> prints out its recovery id.\n\n```java\nfor (DeletedKey deletedKey : keyClient.listDeletedKeys(new Context(\"key1\", \"value1\"))) {\n System.out.printf(\"Deleted key's recovery id:%s%n\", deletedKey.getRecoveryId());\n }\n```\n\n**Code Samples to iterate over deleted keys by page**\n\nIterates over the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> by page in the key vault and for each deleted key prints out its recovery id.\n\n```java\nkeyClient.listDeletedKeys().iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(deletedKey ->\n System.out.printf(\"Deleted key's recovery id:%s%n\", deletedKey.getRecoveryId()));\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of all of the <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> in the vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.DeletedKey?alt=com.azure.security.keyvault.keys.models.DeletedKey&text=DeletedKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeyVersions(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeyVersions(String name)"
name: "listPropertiesOfKeyVersions(String name)"
nameWithType: "KeyClient.listPropertiesOfKeyVersions(String name)"
summary: "List all versions of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref>."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public PagedIterable<KeyProperties> listPropertiesOfKeyVersions(String name)"
desc: "List all versions of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref>. The individual key response in the flux is represented by <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> as only the key identifier, attributes and tags are provided in the response. The key material values are not provided in the response. This operation requires the `keys/list` permission.\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material for each version from this information. Loop over the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> with key material included of the specified versions.\n\n```java\nfor (KeyProperties keyProperties : keyClient.listPropertiesOfKeyVersions(\"keyName\")) {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key version: %s with name: %s and type: %s%n\",\n key.getProperties().getVersion(), key.getName(), key.getKeyType());\n }\n```\n\n**Code Samples to iterate over key versions by page**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material for each version from this information. Iterate over all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> by page and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> with key material included of the specified versions.\n\n```java\nkeyClient.listPropertiesOfKeyVersions(\"keyName\").iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(keyProperties ->\n System.out.printf(\"Key name: %s. Key version: %s.%n\", keyProperties.getName(),\n keyProperties.getVersion()));\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of all the versions of the specified key in the vault.\n The list is empty if a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided <code>name</code> does not exist in the key vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeyVersions(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeyVersions(String name, Context context)"
name: "listPropertiesOfKeyVersions(String name, Context context)"
nameWithType: "KeyClient.listPropertiesOfKeyVersions(String name, Context context)"
summary: "List all versions of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref>."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public PagedIterable<KeyProperties> listPropertiesOfKeyVersions(String name, Context context)"
desc: "List all versions of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref>. The individual key response in the flux is represented by <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> as only the key identifier, attributes and tags are provided in the response. The key material values are not provided in the response. This operation requires the `keys/list` permission.\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material for each version from this information. Loop over the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> with key material included of the specified versions.\n\n```java\nfor (KeyProperties keyProperties : keyClient.listPropertiesOfKeyVersions(\"keyName\", new Context(\"key1\", \"value1\"))) {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key version: %s with name: %s and type: %s%n\",\n key.getProperties().getVersion(), key.getName(), key.getKeyType());\n }\n```\n\n**Code Samples to iterate over key versions by page**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material for each version from this information. Iterate over all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> by page and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> with key material included of the specified versions.\n\n```java\nkeyClient.listPropertiesOfKeyVersions(\"keyName\").iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(keyProperties ->\n System.out.printf(\"Key name: %s. Key version: %s.%n\", keyProperties.getName(),\n keyProperties.getVersion()));\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of all the versions of the specified\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the vault. The list is empty if a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided\n <code>name</code> does not exist in the key vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeys()"
fullName: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeys()"
name: "listPropertiesOfKeys()"
nameWithType: "KeyClient.listPropertiesOfKeys()"
summary: "List <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault."
syntax: "public PagedIterable<KeyProperties> listPropertiesOfKeys()"
desc: "List <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault. Retrieves a list of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault as <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> structures that contain the public part of a stored <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The list operation is applicable to all <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key types\"></xref> and the individual <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> response in the list is represented by <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> as only the key identifier, attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the `keys/list` permission.\n\n**Code Samples**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material from this information. Loop over the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with key material included as of its latest version.\n\n```java\nfor (KeyProperties keyProperties : keyClient.listPropertiesOfKeys()) {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key with name: %s and type: %s%n\", key.getName(), key.getKeyType());\n }\n```\n\n**Iterate keys by page**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material from this information. Iterate over all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> by page and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with key material included as of its latest version.\n\n```java\nkeyClient.listPropertiesOfKeys().iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(keyProperties -> {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key with name: %s and type: %s%n\", key.getName(),\n key.getKeyType());\n });\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeys(com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.listPropertiesOfKeys(Context context)"
name: "listPropertiesOfKeys(Context context)"
nameWithType: "KeyClient.listPropertiesOfKeys(Context context)"
summary: "List <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault."
parameters:
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public PagedIterable<KeyProperties> listPropertiesOfKeys(Context context)"
desc: "List <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault. Retrieves a list of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the key vault as <xref uid=\"com.azure.security.keyvault.keys.models.JsonWebKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWebKey\"></xref> structures that contain the public part of a stored <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The list operation is applicable to all <xref uid=\"com.azure.security.keyvault.keys.models.KeyType\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key types\"></xref> and the individual <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> response in the list is represented by <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> as only the key identifier, attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the `keys/list` permission.\n\n**Code Samples**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material from this information. Loop over the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with key material included as of its latest version.\n\n```java\nfor (KeyProperties keyProperties : keyClient.listPropertiesOfKeys(new Context(\"key1\", \"value1\"))) {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key with name: %s and type: %s%n\", key.getName(),\n key.getKeyType());\n }\n```\n\n**Iterate by page**\n\nIt is possible to get <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"full keys\"></xref> with key material from this information. Iterate over all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyProperties\"></xref> by page and call <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String, String)\"></xref>. This will return the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with key material included as of its latest version.\n\n```java\nkeyClient.listPropertiesOfKeys().iterableByPage().forEach(pagedResponse -> {\n System.out.printf(\"Got response details. Url: %s. Status code: %d.%n\",\n pagedResponse.getRequest().getUrl(), pagedResponse.getStatusCode());\n pagedResponse.getElements().forEach(keyProperties -> {\n KeyVaultKey key = keyClient.getKey(keyProperties.getName(), keyProperties.getVersion());\n\n System.out.printf(\"Retrieved key with name: %s and type: %s%n\", key.getName(),\n key.getKeyType());\n });\n });\n```"
returns:
description: "<xref uid=\"com.azure.core.http.rest.PagedIterable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"PagedIterable\"></xref> of <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> of all the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the vault."
type: "<xref href=\"com.azure.core.http.rest.PagedIterable?alt=com.azure.core.http.rest.PagedIterable&text=PagedIterable\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.purgeDeletedKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.purgeDeletedKey(String name)"
name: "purgeDeletedKey(String name)"
nameWithType: "KeyClient.purgeDeletedKey(String name)"
summary: "Permanently deletes the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> without the possibility of recovery."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public void purgeDeletedKey(String name)"
desc: "Permanently deletes the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> without the possibility of recovery. The purge deleted key operation is applicable for soft-delete enabled vaults. This operation requires the `keys/purge` permission.\n\n**Code Samples**\n\nPurges the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> from the key vault enabled for soft-delete.\n\n```java\nkeyClient.purgeDeletedKey(\"deletedKeyName\");\n```"
- uid: "com.azure.security.keyvault.keys.KeyClient.purgeDeletedKeyWithResponse(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.purgeDeletedKeyWithResponse(String name, Context context)"
name: "purgeDeletedKeyWithResponse(String name, Context context)"
nameWithType: "KeyClient.purgeDeletedKeyWithResponse(String name, Context context)"
summary: "Permanently deletes the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> without the possibility of recovery."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<Void> purgeDeletedKeyWithResponse(String name, Context context)"
desc: "Permanently deletes the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> without the possibility of recovery. The purge deleted key operation is applicable for soft-delete enabled vaults. This operation requires the `keys/purge` permission.\n\n**Code Samples**\n\nPurges the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted key\"></xref> from the key vault enabled for soft-delete.\n\n```java\nResponse<Void> purgeDeletedKeyResponse = keyClient.purgeDeletedKeyWithResponse(\"deletedKeyName\",\n new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Purge response status code: %d%n\", purgeDeletedKeyResponse.getStatusCode());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> containing status code and HTTP headers."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.releaseKey(java.lang.String,java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.releaseKey(String name, String targetAttestationToken)"
name: "releaseKey(String name, String targetAttestationToken)"
nameWithType: "KeyClient.releaseKey(String name, String targetAttestationToken)"
summary: "Releases the latest version of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to release."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The attestation assertion for the target of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> release."
name: "targetAttestationToken"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public ReleaseKeyResult releaseKey(String name, String targetAttestationToken)"
desc: "Releases the latest version of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> must be exportable. This operation requires the `keys/release` permission.\n\n**Code Samples**\n\nReleases a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the signed object that contains the release key.\n\n```java\nString targetAttestationToken = \"someAttestationToken\";\n ReleaseKeyResult releaseKeyResult = keyClient.releaseKey(\"keyName\", targetAttestationToken);\n\n System.out.printf(\"Signed object containing released key: %s%n\", releaseKeyResult);\n```"
returns:
description: "The key release result containing the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"released key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.ReleaseKeyResult?alt=com.azure.security.keyvault.keys.models.ReleaseKeyResult&text=ReleaseKeyResult\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.releaseKey(java.lang.String,java.lang.String,java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.releaseKey(String name, String version, String targetAttestationToken)"
name: "releaseKey(String name, String version, String targetAttestationToken)"
nameWithType: "KeyClient.releaseKey(String name, String version, String targetAttestationToken)"
summary: "Releases a specific version of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to release."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The version of the key to release. If this is empty or <code>null</code>, this call is equivalent to\n calling <xref uid=\"com.azure.security.keyvault.keys.KeyClient.releaseKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#releaseKey(String, String)\"></xref>, with the latest key version being released."
name: "version"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The attestation assertion for the target of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> release."
name: "targetAttestationToken"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public ReleaseKeyResult releaseKey(String name, String version, String targetAttestationToken)"
desc: "Releases a specific version of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>.\n\nThe <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> must be exportable. This operation requires the `keys/release` permission.\n\n**Code Samples**\n\nReleases a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the signed object that contains the release key.\n\n```java\nString myKeyVersion = \"6A385B124DEF4096AF1361A85B16C204\";\n String myTargetAttestationToken = \"someAttestationToken\";\n ReleaseKeyResult releaseKeyVersionResult =\n keyClient.releaseKey(\"keyName\", myKeyVersion, myTargetAttestationToken);\n\n System.out.printf(\"Signed object containing released key: %s%n\", releaseKeyVersionResult);\n```"
returns:
description: "The key release result containing the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"released key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.ReleaseKeyResult?alt=com.azure.security.keyvault.keys.models.ReleaseKeyResult&text=ReleaseKeyResult\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.releaseKeyWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.security.keyvault.keys.models.ReleaseKeyOptions,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.releaseKeyWithResponse(String name, String version, String targetAttestationToken, ReleaseKeyOptions releaseKeyOptions, Context context)"
name: "releaseKeyWithResponse(String name, String version, String targetAttestationToken, ReleaseKeyOptions releaseKeyOptions, Context context)"
nameWithType: "KeyClient.releaseKeyWithResponse(String name, String version, String targetAttestationToken, ReleaseKeyOptions releaseKeyOptions, Context context)"
summary: "Releases a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to release."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to release. If this is empty or <code>null</code>, this call\n is equivalent to calling <xref uid=\"com.azure.security.keyvault.keys.KeyClient.releaseKey(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#releaseKey(String, String)\"></xref>, with the latest key version being\n released."
name: "version"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The attestation assertion for the target of the key release."
name: "targetAttestationToken"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.security.keyvault.keys.models.ReleaseKeyOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref> for releasing a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "releaseKeyOptions"
type: "<xref href=\"com.azure.security.keyvault.keys.models.ReleaseKeyOptions?alt=com.azure.security.keyvault.keys.models.ReleaseKeyOptions&text=ReleaseKeyOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<ReleaseKeyResult> releaseKeyWithResponse(String name, String version, String targetAttestationToken, ReleaseKeyOptions releaseKeyOptions, Context context)"
desc: "Releases a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>.\n\nThe key must be exportable. This operation requires the `keys/release` permission.\n\n**Code Samples**\n\nReleases a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP Response\"></xref> details and the signed object that contains the release key.\n\n```java\nString releaseKeyVersion = \"6A385B124DEF4096AF1361A85B16C204\";\n String someTargetAttestationToken = \"someAttestationToken\";\n ReleaseKeyOptions releaseKeyOptions = new ReleaseKeyOptions()\n .setAlgorithm(KeyExportEncryptionAlgorithm.RSA_AES_KEY_WRAP_256)\n .setNonce(\"someNonce\");\n\n Response<ReleaseKeyResult> releaseKeyResultResponse =\n keyClient.releaseKeyWithResponse(\"keyName\", releaseKeyVersion, someTargetAttestationToken,\n releaseKeyOptions, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Response received successfully with status code: %d. Signed object containing\"\n + \"released key: %s%n\", releaseKeyResultResponse.getStatusCode(),\n releaseKeyResultResponse.getValue().getValue());\n```"
returns:
description: "The <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP response\"></xref> for this operation and the <xref uid=\"com.azure.security.keyvault.keys.models.ReleaseKeyResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ReleaseKeyResult\"></xref> containing the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"released key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.ReleaseKeyResult?alt=com.azure.security.keyvault.keys.models.ReleaseKeyResult&text=ReleaseKeyResult\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.restoreKeyBackup(byte[])"
fullName: "com.azure.security.keyvault.keys.KeyClient.restoreKeyBackup(byte[] backup)"
name: "restoreKeyBackup(byte[] backup)"
nameWithType: "KeyClient.restoreKeyBackup(byte[] backup)"
summary: "Restores a backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to a vault."
parameters:
- description: "The backup blob associated with the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "backup"
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public KeyVaultKey restoreKeyBackup(byte[] backup)"
desc: "Restores a backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to a vault. Imports a previously backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> into Azure Key Vault, restoring the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, its key identifier, attributes and access control policies. The restore operation may be used to import a previously backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Individual versions of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> cannot be restored. The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target key vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier will change if the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject to security constraints: The target key vault must be owned by the same Microsoft Azure Subscription as the source key vault. The user must have the `restore` permission in the target key vault. This operation requires the `keys/restore` permission.\n\n**Code Samples**\n\nRestores the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault from its backup.\n\n// Pass the key backup byte array to the restore operation.\n\n```java\nbyte[] keyBackupByteArray = {};\n KeyVaultKey keyResponse = keyClient.restoreKeyBackup(keyBackupByteArray);\n System.out.printf(\"Restored key with name: %s and: id %s%n\", keyResponse.getName(), keyResponse.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"restored key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.restoreKeyBackupWithResponse(byte[],com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.restoreKeyBackupWithResponse(byte[] backup, Context context)"
name: "restoreKeyBackupWithResponse(byte[] backup, Context context)"
nameWithType: "KeyClient.restoreKeyBackupWithResponse(byte[] backup, Context context)"
summary: "Restores a backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to a vault."
parameters:
- description: "The backup blob associated with the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "backup"
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> restoreKeyBackupWithResponse(byte[] backup, Context context)"
desc: "Restores a backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to a vault. Imports a previously backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> into Azure Key Vault, restoring the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, its key identifier, attributes and access control policies. The restore operation may be used to import a previously backed up <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Individual versions of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> cannot be restored. The <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target key vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier will change if the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject to security constraints: The target key vault must be owned by the same Microsoft Azure Subscription as the source key vault. The user must have the `restore` permission in the target key vault. This operation requires the `keys/restore` permission.\n\n**Code Samples**\n\nRestores the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault from its backup. Prints out the details of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"restored key\"></xref> returned in the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTPresponse\"></xref>.\n\n// Pass the key backup byte array to the restore operation.\n\n```java\nResponse<KeyVaultKey> keyResponse = keyClient.restoreKeyBackupWithResponse(keyBackupByteArray,\n new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Restored key with name: %s and: id %s%n\",\n keyResponse.getValue().getName(), keyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"restored key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.rotateKey(java.lang.String)"
fullName: "com.azure.security.keyvault.keys.KeyClient.rotateKey(String name)"
name: "rotateKey(String name)"
nameWithType: "KeyClient.rotateKey(String name)"
summary: "Rotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
parameters:
- description: "The name of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to be rotated. The system will generate a new version in the\n specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public KeyVaultKey rotateKey(String name)"
desc: "Rotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The rotate key operation will do so based on <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key's rotation policy\"></xref>. This operation requires the `keys/rotate` permission.\n\n**Code Samples**\n\nRotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotated key\"></xref> details.\n\n```java\nKeyVaultKey key = keyClient.rotateKey(\"keyName\");\n\n System.out.printf(\"Rotated key with name: %s and version:%s%n\", key.getName(),\n key.getProperties().getVersion());\n```"
returns:
description: "The new version of the rotated <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.rotateKeyWithResponse(java.lang.String,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.rotateKeyWithResponse(String name, Context context)"
name: "rotateKeyWithResponse(String name, Context context)"
nameWithType: "KeyClient.rotateKeyWithResponse(String name, Context context)"
summary: "Rotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
parameters:
- description: "The name of <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> to be rotated. The system will generate a new version in the\n specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyVaultKey> rotateKeyWithResponse(String name, Context context)"
desc: "Rotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. The rotate key operation will do so based on <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key's rotation policy\"></xref>. This operation requires the `keys/rotate` permission.\n\n**Code Samples**\n\nRotates a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP Response\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotated key\"></xref> details.\n\n```java\nResponse<KeyVaultKey> keyResponse = keyClient.rotateKeyWithResponse(\"keyName\", new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Response received successfully with status code: %d. Rotated key with name: %s and\"\n + \"version: %s%n\", keyResponse.getStatusCode(), keyResponse.getValue().getName(),\n keyResponse.getValue().getProperties().getVersion());\n```"
returns:
description: "The <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP response\"></xref> for this operation containing the new version of the rotated\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.updateKeyProperties(com.azure.security.keyvault.keys.models.KeyProperties,com.azure.security.keyvault.keys.models.KeyOperation...)"
fullName: "com.azure.security.keyvault.keys.KeyClient.updateKeyProperties(KeyProperties keyProperties, KeyOperation[] keyOperations)"
name: "updateKeyProperties(KeyProperties keyProperties, KeyOperation[] keyOperations)"
nameWithType: "KeyClient.updateKeyProperties(KeyProperties keyProperties, KeyOperation[] keyOperations)"
summary: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> associated with the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, but not the cryptographic key material of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key properties\"></xref> object with updated properties."
name: "keyProperties"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "The updated <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> to associate with the key."
name: "keyOperations"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyOperation?alt=com.azure.security.keyvault.keys.models.KeyOperation&text=KeyOperation\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public KeyVaultKey updateKeyProperties(KeyProperties keyProperties, KeyOperation[] keyOperations)"
desc: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> associated with the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, but not the cryptographic key material of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault. The update operation changes specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> of an existing stored <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> that are not specified in the request are left unchanged. The cryptographic key material of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> itself cannot be changed. This operation requires the `keys/set` permission.\n\n**Code Samples**\n\nGets the latest version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, changes its expiry time and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> and the updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault.\n\n```java\nKeyVaultKey key = keyClient.getKey(\"keyName\");\n\n key.getProperties().setExpiresOn(OffsetDateTime.now().plusDays(60));\n\n KeyVaultKey updatedKey = keyClient.updateKeyProperties(key.getProperties(), KeyOperation.ENCRYPT,\n KeyOperation.DECRYPT);\n\n System.out.printf(\"Key is updated with name %s and id %s %n\", updatedKey.getName(), updatedKey.getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"updated key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.updateKeyPropertiesWithResponse(com.azure.security.keyvault.keys.models.KeyProperties,com.azure.core.util.Context,com.azure.security.keyvault.keys.models.KeyOperation...)"
fullName: "com.azure.security.keyvault.keys.KeyClient.updateKeyPropertiesWithResponse(KeyProperties keyProperties, Context context, KeyOperation[] keyOperations)"
name: "updateKeyPropertiesWithResponse(KeyProperties keyProperties, Context context, KeyOperation[] keyOperations)"
nameWithType: "KeyClient.updateKeyPropertiesWithResponse(KeyProperties keyProperties, Context context, KeyOperation[] keyOperations)"
summary: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> associated with the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, but not the cryptographic key material of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault."
parameters:
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key properties\"></xref> object with updated properties."
name: "keyProperties"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyProperties?alt=com.azure.security.keyvault.keys.models.KeyProperties&text=KeyProperties\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
- description: "The updated <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> to associate with the key."
name: "keyOperations"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyOperation?alt=com.azure.security.keyvault.keys.models.KeyOperation&text=KeyOperation\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public Response<KeyVaultKey> updateKeyPropertiesWithResponse(KeyProperties keyProperties, Context context, KeyOperation[] keyOperations)"
desc: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> associated with the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, but not the cryptographic key material of the specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault. The update operation changes specified <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> of an existing stored <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"attributes\"></xref> that are not specified in the request are left unchanged. The cryptographic key material of a <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> itself cannot be changed. This operation requires the `keys/set` permission.\n\n**Code Samples**\n\nGets the latest version of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>, changes its expiry time and <xref uid=\"com.azure.security.keyvault.keys.models.KeyOperation\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key operations\"></xref> and the updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> in the key vault.\n\n```java\nKeyVaultKey key = keyClient.getKey(\"keyName\");\n\n key.getProperties().setExpiresOn(OffsetDateTime.now().plusDays(60));\n\n Response<KeyVaultKey> updateKeyResponse =\n keyClient.updateKeyPropertiesWithResponse(key.getProperties(), new Context(\"key1\", \"value1\"),\n KeyOperation.ENCRYPT, KeyOperation.DECRYPT);\n\n System.out.printf(\"Updated key with name: %s and id: %s%n\", updateKeyResponse.getValue().getName(),\n updateKeyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Response\"></xref> whose <xref uid=\"com.azure.core.http.rest.Response.getValue*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"value\"></xref> contains the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"updated key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyVaultKey?alt=com.azure.security.keyvault.keys.models.KeyVaultKey&text=KeyVaultKey\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.security.keyvault.keys.KeyClient.updateKeyRotationPolicy(java.lang.String,com.azure.security.keyvault.keys.models.KeyRotationPolicy)"
fullName: "com.azure.security.keyvault.keys.KeyClient.updateKeyRotationPolicy(String keyName, KeyRotationPolicy keyRotationPolicy)"
name: "updateKeyRotationPolicy(String keyName, KeyRotationPolicy keyRotationPolicy)"
nameWithType: "KeyClient.updateKeyRotationPolicy(String keyName, KeyRotationPolicy keyRotationPolicy)"
summary: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the ke<xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>y."
name: "keyRotationPolicy"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />"
syntax: "public KeyRotationPolicy updateKeyRotationPolicy(String keyName, KeyRotationPolicy keyRotationPolicy)"
desc: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref> with the provided name. This operation requires the `keys/update` permission.\n\n**Code Samples**\n\nUpdates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy\"></xref> of a given <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy key\"></xref> details.\n\n```java\nList<KeyRotationLifetimeAction> lifetimeActions = new ArrayList<>();\n KeyRotationLifetimeAction rotateLifetimeAction = new KeyRotationLifetimeAction(KeyRotationPolicyAction.ROTATE)\n .setTimeAfterCreate(\"P90D\");\n KeyRotationLifetimeAction notifyLifetimeAction = new KeyRotationLifetimeAction(KeyRotationPolicyAction.NOTIFY)\n .setTimeBeforeExpiry(\"P45D\");\n\n lifetimeActions.add(rotateLifetimeAction);\n lifetimeActions.add(notifyLifetimeAction);\n\n KeyRotationPolicy keyRotationPolicy = new KeyRotationPolicy()\n .setLifetimeActions(lifetimeActions)\n .setExpiresIn(\"P6M\");\n\n KeyRotationPolicy updatedPolicy =\n keyClient.updateKeyRotationPolicy(\"keyName\", keyRotationPolicy);\n\n System.out.printf(\"Updated key rotation policy with id: %s%n\", updatedPolicy.getId());\n```"
returns:
description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.security.keyvault.keys.KeyClient.updateKeyRotationPolicyWithResponse(java.lang.String,com.azure.security.keyvault.keys.models.KeyRotationPolicy,com.azure.core.util.Context)"
fullName: "com.azure.security.keyvault.keys.KeyClient.updateKeyRotationPolicyWithResponse(String keyName, KeyRotationPolicy keyRotationPolicy, Context context)"
name: "updateKeyRotationPolicyWithResponse(String keyName, KeyRotationPolicy keyRotationPolicy, Context context)"
nameWithType: "KeyClient.updateKeyRotationPolicyWithResponse(String keyName, KeyRotationPolicy keyRotationPolicy, Context context)"
summary: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> of the key with the provided name."
parameters:
- description: "The name of the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
name: "keyName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the key."
name: "keyRotationPolicy"
type: "<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> that is passed through the <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipeline\"></xref> during the service\n call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Response<KeyRotationPolicy> updateKeyRotationPolicyWithResponse(String keyName, KeyRotationPolicy keyRotationPolicy, Context context)"
desc: "Updates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> of the key with the provided name. This operation requires the `keys/update` permission.\n\n**Code Samples**\n\nUpdates the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy\"></xref> of a given <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>. Prints out the <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP Response\"></xref> and <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"rotation policy key\"></xref> details.\n\n```java\nList<KeyRotationLifetimeAction> myLifetimeActions = new ArrayList<>();\n KeyRotationLifetimeAction myRotateLifetimeAction = new KeyRotationLifetimeAction(KeyRotationPolicyAction.ROTATE)\n .setTimeAfterCreate(\"P90D\");\n KeyRotationLifetimeAction myNotifyLifetimeAction = new KeyRotationLifetimeAction(KeyRotationPolicyAction.NOTIFY)\n .setTimeBeforeExpiry(\"P45D\");\n\n myLifetimeActions.add(myRotateLifetimeAction);\n myLifetimeActions.add(myNotifyLifetimeAction);\n\n KeyRotationPolicy myKeyRotationPolicy = new KeyRotationPolicy()\n .setLifetimeActions(myLifetimeActions)\n .setExpiresIn(\"P6M\");\n\n Response<KeyRotationPolicy> keyRotationPolicyResponse = keyClient.updateKeyRotationPolicyWithResponse(\n \"keyName\", myKeyRotationPolicy, new Context(\"key1\", \"value1\"));\n\n System.out.printf(\"Response received successfully with status code: %d. Updated key rotation policy\"\n + \"with id: %s%n\", keyRotationPolicyResponse.getStatusCode(), keyRotationPolicyResponse.getValue().getId());\n```"
returns:
description: "A <xref uid=\"com.azure.core.http.rest.Response\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HTTP response\"></xref> for this operation containing the <xref uid=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyRotationPolicy\"></xref> for the\n <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"key\"></xref>."
type: "<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.security.keyvault.keys.models.KeyRotationPolicy?alt=com.azure.security.keyvault.keys.models.KeyRotationPolicy&text=KeyRotationPolicy\" data-throw-if-not-resolved=\"False\" />&gt;"
type: "class"
desc: "The <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> provides synchronous methods to manage <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref> in the Azure Key Vault. The client supports creating, retrieving, updating, deleting, purging, backing up, restoring, listing, releasing and rotating the <xref uid=\"com.azure.security.keyvault.keys.models.KeyVaultKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"keys\"></xref>. The client also supports listing <xref uid=\"com.azure.security.keyvault.keys.models.DeletedKey\" data-throw-if-not-resolved=\"false\" data-raw-source=\"deleted keys\"></xref> for a soft-delete enabled Azure Key Vault.\n\n## Getting Started ##\n\nIn order to interact with the Azure Key Vault service, you will need to create an instance of the <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> class, a vault url and a credential object.\n\nThe examples shown in this document use a credential object named DefaultAzureCredential for authentication, which is appropriate for most scenarios, including local development and production environments. Additionally, we recommend using a [ managed identity][managed identity] for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the [ Azure Identity documentation\"][Azure Identity documentation].\n\n**Sample: Construct Synchronous Key Client**\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref>, using the <xref uid=\"com.azure.security.keyvault.keys.KeyClientBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClientBuilder\"></xref> to configure it.\n\n```java\nKeyClient keyClient = new KeyClientBuilder()\n .vaultUrl(\"<your-key-vault-url>\")\n .credential(new DefaultAzureCredentialBuilder().build())\n .buildClient();\n```\n\n\n--------------------\n\n## Create a Cryptographic Key ##\n\nThe <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> can be used to create a key in the key vault.\n\n**Code Sample:**\n\nThe following code sample demonstrates how to synchronously create a cryptographic key in the key vault, using the <xref uid=\"com.azure.security.keyvault.keys.KeyClient.createKey(java.lang.String,com.azure.security.keyvault.keys.models.KeyType)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#createKey(String, KeyType)\"></xref> API.\n\n```java\nKeyVaultKey key = keyClient.createKey(\"keyName\", KeyType.EC);\n System.out.printf(\"Created key with name: %s and id: %s%n\", key.getName(), key.getId());\n```\n\n**Note:** For the asynchronous sample, refer to <xref uid=\"com.azure.security.keyvault.keys.KeyAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyAsyncClient\"></xref>.\n\n\n--------------------\n\n## Get a Cryptographic Key ##\n\nThe <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> can be used to retrieve a key from the key vault.\n\n**Code Sample:**\n\nThe following code sample demonstrates how to synchronously retrieve a key from the key vault, using the <xref uid=\"com.azure.security.keyvault.keys.KeyClient.getKey(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#getKey(String)\"></xref> API.\n\n```java\nKeyVaultKey keyWithVersionValue = keyClient.getKey(\"keyName\");\n\n System.out.printf(\"Retrieved key with name: %s and: id %s%n\", keyWithVersionValue.getName(),\n keyWithVersionValue.getId());\n```\n\n**Note:** For the asynchronous sample, refer to <xref uid=\"com.azure.security.keyvault.keys.KeyAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyAsyncClient\"></xref>.\n\n\n--------------------\n\n## Delete a Cryptographic Key ##\n\nThe <xref uid=\"com.azure.security.keyvault.keys.KeyClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient\"></xref> can be used to delete a key from the key vault.\n\n**Code Sample:**\n\nThe following code sample demonstrates how to synchronously delete a key from the key vault, using the <xref uid=\"com.azure.security.keyvault.keys.KeyClient.beginDeleteKey(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyClient#beginDeleteKey(String)\"></xref> API.\n\n```java\nSyncPoller<DeletedKey, Void> deleteKeyPoller = keyClient.beginDeleteKey(\"keyName\");\n PollResponse<DeletedKey> deleteKeyPollResponse = deleteKeyPoller.poll();\n\n // Deleted date only works for SoftDelete Enabled Key Vault.\n DeletedKey deletedKey = deleteKeyPollResponse.getValue();\n\n System.out.printf(\"Key delete date: %s%n\", deletedKey.getDeletedOn());\n System.out.printf(\"Deleted key's recovery id: %s%n\", deletedKey.getRecoveryId());\n\n // Key is being deleted on the server.\n deleteKeyPoller.waitForCompletion();\n // Key is deleted\n```\n\n**Note:** For the asynchronous sample, refer to <xref uid=\"com.azure.security.keyvault.keys.KeyAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"KeyAsyncClient\"></xref>.\n\n\n[managed identity]: https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/\n[Azure Identity documentation]: https://learn.microsoft.com/java/api/overview/azure/identity-readme?view=azure-java-stable"
metadata: {}
package: "com.azure.security.keyvault.keys"
artifact: com.azure:azure-security-keyvault-keys:4.9.0