# Cloud KMS V1 Client - Class ImportCryptoKeyVersionRequest (2.9.0)

2.9.0 (latest) 2.8.0 2.7.0 2.6.0 2.5.2 2.4.0 2.3.1 2.2.0 2.1.6 2.0.0 1.23.0 1.22.1 1.21.4 1.20.3 1.19.0 1.18.1 1.17.0 1.16.4 1.15.3 Reference documentation and code samples for the Cloud KMS V1 Client class ImportCryptoKeyVersionRequest.

Request message for
[KeyManagementService.ImportCryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__).

Generated from protobuf message `google.cloud.kms.v1.ImportCryptoKeyVersionRequest`

## Namespace

Google \\ Cloud \\ Kms \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getName__) of the [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) to be imported into. The create permission is only required on this key when creating a new [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion). |
| `↳ crypto_key_version` | `string` Optional. The optional [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of an existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) to target for an import operation. If this field is not present, a new [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) containing the supplied key material is created. If this field is present, the supplied key material is imported into the existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion). To import into an existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion), the [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) must be a child of [ImportCryptoKeyVersionRequest.parent](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getParent__), have been previously created via [ImportCryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__), and be in [DESTROYED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__DESTROYED) or [IMPORT_FAILED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__IMPORT_FAILED) state. The key material and algorithm must match the previous [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) exactly if the [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) has ever contained key material. |
| `↳ algorithm` | `int` Required. The [algorithm](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionAlgorithm) of the key being imported. This does not need to match the [version_template](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__) of the [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) this version imports into. |
| `↳ import_job` | `string` Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getName__) of the [ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) that was used to wrap this key material. |
| `↳ wrapped_key` | `string` Optional. The wrapped key material to import. Before wrapping, key material must be formatted. If importing symmetric key material, the expected key material format is plain bytes. If importing asymmetric key material, the expected key material format is PKCS#8-encoded DER (the PrivateKeyInfo structure from RFC 5208). When wrapping with import methods (\[RSA_OAEP_3072_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256\] or \[RSA_OAEP_4096_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256\] or \[RSA_OAEP_3072_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256\] or \[RSA_OAEP_4096_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256\]), this field must contain the concatenation of: 1. An ephemeral AES-256 wrapping key wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty label. 2. The formatted key to be imported, wrapped with the ephemeral AES-256 key using AES-KWP (RFC 5649). This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP. When wrapping with import methods (\[RSA_OAEP_3072_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256\] or \[RSA_OAEP_4096_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256\]), this field must contain the formatted key to be imported, wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-256, MGF1 with SHA-256, and an empty label. <br /> |
| `↳ rsa_aes_wrapped_key` | `string` Optional. This field has the same meaning as [wrapped_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getWrappedKey__). Prefer to use that field in new work. Either that field or this field (but not both) must be specified. |

### getParent

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getName__) of the
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) to be imported into.

The create permission is only required on this key when creating a new
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setParent

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getName__) of the
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) to be imported into.

The create permission is only required on this key when creating a new
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCryptoKeyVersion

Optional. The optional [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of
an existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) to
target for an import operation. If this field is not present, a new
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) containing the
supplied key material is created.

If this field is present, the supplied key material is imported into
the existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion). To
import into an existing
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion), the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) must be a child of
[ImportCryptoKeyVersionRequest.parent](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getParent__),
have been previously created via
[ImportCryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__),
and be in
[DESTROYED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__DESTROYED)
or
[IMPORT_FAILED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__IMPORT_FAILED)
state. The key material and algorithm must match the previous
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) exactly if the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) has ever contained
key material.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCryptoKeyVersion

Optional. The optional [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of
an existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) to
target for an import operation. If this field is not present, a new
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) containing the
supplied key material is created.

If this field is present, the supplied key material is imported into
the existing [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion). To
import into an existing
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion), the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) must be a child of
[ImportCryptoKeyVersionRequest.parent](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getParent__),
have been previously created via
[ImportCryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__),
and be in
[DESTROYED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__DESTROYED)
or
[IMPORT_FAILED](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionState#_Google_Cloud_Kms_V1_CryptoKeyVersion_CryptoKeyVersionState__IMPORT_FAILED)
state. The key material and algorithm must match the previous
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) exactly if the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) has ever contained
key material.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAlgorithm

Required. The
[algorithm](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionAlgorithm)
of the key being imported. This does not need to match the
[version_template](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__) of the
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) this version imports into.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [CryptoKeyVersionAlgorithm](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionAlgorithm). |

### setAlgorithm

Required. The
[algorithm](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionAlgorithm)
of the key being imported. This does not need to match the
[version_template](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__) of the
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) this version imports into.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [CryptoKeyVersionAlgorithm](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion.CryptoKeyVersionAlgorithm). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImportJob

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getName__) of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) that was used to wrap this key
material.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setImportJob

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getName__) of the
[ImportJob](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob) that was used to wrap this key
material.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getWrappedKey

Optional. The wrapped key material to import.

Before wrapping, key material must be formatted. If importing symmetric key
material, the expected key material format is plain bytes. If importing
asymmetric key material, the expected key material format is PKCS#8-encoded
DER (the PrivateKeyInfo structure from RFC 5208).
When wrapping with import methods
(\[RSA_OAEP_3072_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256\]
or
\[RSA_OAEP_4096_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256\]
or
\[RSA_OAEP_3072_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256\]
or
\[RSA_OAEP_4096_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256\]),
this field must contain the concatenation of:

1. An ephemeral AES-256 wrapping key wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty label.
2. The formatted key to be imported, wrapped with the ephemeral AES-256 key using AES-KWP (RFC 5649).

This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP. When wrapping with import methods (\[RSA_OAEP_3072_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256\] or \[RSA_OAEP_4096_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256\]), this field must contain the formatted key to be imported, wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-256, MGF1 with SHA-256, and an empty label.

<br />

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setWrappedKey

Optional. The wrapped key material to import.

Before wrapping, key material must be formatted. If importing symmetric key
material, the expected key material format is plain bytes. If importing
asymmetric key material, the expected key material format is PKCS#8-encoded
DER (the PrivateKeyInfo structure from RFC 5208).
When wrapping with import methods
(\[RSA_OAEP_3072_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256\]
or
\[RSA_OAEP_4096_SHA1_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256\]
or
\[RSA_OAEP_3072_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256\]
or
\[RSA_OAEP_4096_SHA256_AES_256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256\]),
this field must contain the concatenation of:

1. An ephemeral AES-256 wrapping key wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty label.
2. The formatted key to be imported, wrapped with the ephemeral AES-256 key using AES-KWP (RFC 5649).

This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP. When wrapping with import methods (\[RSA_OAEP_3072_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256\] or \[RSA_OAEP_4096_SHA256\]\[google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256\]), this field must contain the formatted key to be imported, wrapped with the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) using RSAES-OAEP with SHA-256, MGF1 with SHA-256, and an empty label.

<br />

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRsaAesWrappedKey

Optional. This field has the same meaning as
[wrapped_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getWrappedKey__).

Prefer to use that field in new work. Either that field or this field
(but not both) must be specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasRsaAesWrappedKey

### setRsaAesWrappedKey

Optional. This field has the same meaning as
[wrapped_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.ImportCryptoKeyVersionRequest#_Google_Cloud_Kms_V1_ImportCryptoKeyVersionRequest__getWrappedKey__).

Prefer to use that field in new work. Either that field or this field
(but not both) must be specified.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getWrappedKeyMaterial

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |