# Class ImportJob (3.14.0)

3.14.0 (latest) 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.1 3.2.2 3.1.1 3.0.0 2.24.2 2.23.0 2.22.0 2.21.4 2.20.0 2.19.2 2.18.0 2.17.0 2.16.1 2.15.0 2.14.1 2.13.0 2.12.3 2.11.2 2.10.1 2.9.0 2.8.0 2.7.0 2.6.1 2.5.0 2.4.3 2.3.0 2.2.0 2.1.0 2.0.1 1.4.2 1.3.0 1.2.1 1.1.0

    ImportJob(mapping=None, *, ignore_unknown_fields=False, **kwargs)

An ImportJob can be used to create
CryptoKeys and
CryptoKeyVersions using
pre-existing key material, generated outside of Cloud KMS.

When an ImportJob is created, Cloud
KMS will generate a "wrapping key", which is a public/private key
pair. You use the wrapping key to encrypt (also known as wrap) the
pre-existing key material to protect it during the import process.
The nature of the wrapping key depends on the choice of
import_method. When
the wrapping key generation is complete, the
state will be set to
ACTIVE and
the public_key can be
fetched. The fetched public key can then be used to wrap your
pre-existing key material.

Once the key material is wrapped, it can be imported into a new
CryptoKeyVersion in an
existing CryptoKey by calling
ImportCryptoKeyVersion.
Multiple CryptoKeyVersions
can be imported with a single
ImportJob. Cloud KMS uses the
private key portion of the wrapping key to unwrap the key material.
Only Cloud KMS has access to the private key.

An ImportJob expires 3 days after
it is created. Once expired, Cloud KMS will no longer be able to
import or unwrap any key material that was wrapped with the
ImportJob's public key.

For more information, see `Importing a
key <https://cloud.google.com/kms/docs/importing-a-key>`__.

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `name` | `str` Output only. The resource name for this ImportJob in the format `projects/*/locations/*/keyRings/*/importJobs/*`. |
| `import_method` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ImportJob.ImportMethod` Required. Immutable. The wrapping method to be used for incoming key material. |
| `protection_level` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ProtectionLevel` Required. Immutable. The protection level of the ImportJob. This must match the protection_level of the version_template on the CryptoKey you attempt to import into. |
| `create_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. The time at which this ImportJob was created. |
| `generate_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. The time this ImportJob's key material was generated. |
| `expire_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. The time at which this ImportJob is scheduled for expiration and can no longer be used to import key material. |
| `expire_event_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. The time this ImportJob expired. Only present if state is EXPIRED. |
| `state` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ImportJob.ImportJobState` Output only. The current state of the ImportJob, indicating if it can be used. |
| `public_key` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ImportJob.WrappingPublicKey` Output only. The public key with which to wrap key material prior to import. Only returned if state is ACTIVE. |
| `attestation` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.KeyOperationAttestation` Output only. Statement that was generated and signed by the key creator (for example, an HSM) at key creation time. Use this statement to verify attributes of the key as stored on the HSM, independently of Google. Only present if the chosen ImportMethod is one with a protection level of HSM. |
| `crypto_key_backend` | `str` Immutable. The resource name of the backend environment where the key material for the wrapping key resides and where all related cryptographic operations are performed. Currently, this field is only populated for keys stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future. Supported resources: - `"projects/*/locations/*/singleTenantHsmInstances/*"` |

## Classes

### ImportJobState

    ImportJobState(value)

The state of the ImportJob,
indicating if it can be used.

### ImportMethod

    ImportMethod(value)

ImportMethod describes
the key wrapping method chosen for this
ImportJob.

### WrappingPublicKey

    WrappingPublicKey(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The public key component of the wrapping key. For details of the
type of key this public key corresponds to, see the
ImportMethod.