When anImportJobis 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 ofimport_method. When the
wrapping key generation is complete, thestatewill be set toACTIVEand thepublic_keycan 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 newCryptoKeyVersionin an existingCryptoKeyby callingImportCryptoKeyVersion.
MultipleCryptoKeyVersionscan be
imported with a singleImportJob. 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.
AnImportJobexpires 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 theImportJob's public key.
For more information, seeImporting a key.
Generated from protobuf messagegoogle.cloud.kms.v1.ImportJob
Namespace
Google \ Cloud \ Kms \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Output only. The resource name for thisImportJobin the formatprojects/*/locations/*/keyRings/*/importJobs/*.
↳ import_method
int
Required. Immutable. The wrapping method to be used for incoming key material.
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 chosenImportMethodis one with a protection level ofHSM.
getName
Output only. The resource name for thisImportJobin the formatprojects/*/locations/*/keyRings/*/importJobs/*.
Returns
Type
Description
string
setName
Output only. The resource name for thisImportJobin the formatprojects/*/locations/*/keyRings/*/importJobs/*.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getImportMethod
Required. Immutable. The wrapping method to be used for incoming key
material.
Returns
Type
Description
int
setImportMethod
Required. Immutable. The wrapping method to be used for incoming key
material.
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 chosenImportMethodis one with a
protection level ofHSM.
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 chosenImportMethodis one with a
protection level ofHSM.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud KMS V1 Client - Class ImportJob (2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/php/docs/reference/cloud-kms/latest/V1.ImportJob)\n- [2.3.0](/php/docs/reference/cloud-kms/2.3.0/V1.ImportJob)\n- [2.2.0](/php/docs/reference/cloud-kms/2.2.0/V1.ImportJob)\n- [2.1.6](/php/docs/reference/cloud-kms/2.1.6/V1.ImportJob)\n- [2.0.0](/php/docs/reference/cloud-kms/2.0.0/V1.ImportJob)\n- [1.23.0](/php/docs/reference/cloud-kms/1.23.0/V1.ImportJob)\n- [1.22.1](/php/docs/reference/cloud-kms/1.22.1/V1.ImportJob)\n- [1.21.4](/php/docs/reference/cloud-kms/1.21.4/V1.ImportJob)\n- [1.20.3](/php/docs/reference/cloud-kms/1.20.3/V1.ImportJob)\n- [1.19.0](/php/docs/reference/cloud-kms/1.19.0/V1.ImportJob)\n- [1.18.1](/php/docs/reference/cloud-kms/1.18.1/V1.ImportJob)\n- [1.17.0](/php/docs/reference/cloud-kms/1.17.0/V1.ImportJob)\n- [1.16.4](/php/docs/reference/cloud-kms/1.16.4/V1.ImportJob)\n- [1.15.3](/php/docs/reference/cloud-kms/1.15.3/V1.ImportJob) \nReference documentation and code samples for the Cloud KMS V1 Client class ImportJob.\n\nAn [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) can be used to create\n[CryptoKeys](/php/docs/reference/cloud-kms/latest/V1.CryptoKey) and\n[CryptoKeyVersions](/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) using pre-existing\nkey material, generated outside of Cloud KMS.\n\nWhen an [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) is created, Cloud KMS will\ngenerate a \"wrapping key\", which is a public/private key pair. You use the\nwrapping key to encrypt (also known as wrap) the pre-existing key material to\nprotect it during the import process. The nature of the wrapping key depends\non the choice of\n[import_method](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getImportMethod__). When the\nwrapping key generation is complete, the\n[state](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) will be set to\n[ACTIVE](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE) and the\n[public_key](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getPublicKey__) can be fetched. The\nfetched public key can then be used to wrap your pre-existing key material.\nOnce the key material is wrapped, it can be imported into a new\n[CryptoKeyVersion](/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) in an existing\n[CryptoKey](/php/docs/reference/cloud-kms/latest/V1.CryptoKey) by calling\n[ImportCryptoKeyVersion](/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__importCryptoKeyVersion__).\nMultiple [CryptoKeyVersions](/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) can be\nimported with a single [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob). Cloud KMS\nuses the private key portion of the wrapping key to unwrap the key material.\nOnly Cloud KMS has access to the private key.\nAn [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) expires 3 days after it is\ncreated. Once expired, Cloud KMS will no longer be able to import or unwrap\nany key material that was wrapped with the\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s public key.\nFor more information, see\n[Importing a key](https://cloud.google.com/kms/docs/importing-a-key).\n\nGenerated from protobuf message `google.cloud.kms.v1.ImportJob`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Kms \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nOutput only. The resource name for this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) in the format\n`projects/*/locations/*/keyRings/*/importJobs/*`.\n\n### setName\n\nOutput only. The resource name for this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) in the format\n`projects/*/locations/*/keyRings/*/importJobs/*`.\n\n### getImportMethod\n\nRequired. Immutable. The wrapping method to be used for incoming key\nmaterial.\n\n### setImportMethod\n\nRequired. Immutable. The wrapping method to be used for incoming key\nmaterial.\n\n### getProtectionLevel\n\nRequired. Immutable. The protection level of the\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob). This must match the\n[protection_level](/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersionTemplate#_Google_Cloud_Kms_V1_CryptoKeyVersionTemplate__getProtectionLevel__)\nof the [version_template](/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__)\non the [CryptoKey](/php/docs/reference/cloud-kms/latest/V1.CryptoKey) you attempt to import\ninto.\n\n### setProtectionLevel\n\nRequired. Immutable. The protection level of the\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob). This must match the\n[protection_level](/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersionTemplate#_Google_Cloud_Kms_V1_CryptoKeyVersionTemplate__getProtectionLevel__)\nof the [version_template](/php/docs/reference/cloud-kms/latest/V1.CryptoKey#_Google_Cloud_Kms_V1_CryptoKey__getVersionTemplate__)\non the [CryptoKey](/php/docs/reference/cloud-kms/latest/V1.CryptoKey) you attempt to import\ninto.\n\n### getCreateTime\n\nOutput only. The time at which this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) was created.\n\n### hasCreateTime\n\n### clearCreateTime\n\n### setCreateTime\n\nOutput only. The time at which this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) was created.\n\n### getGenerateTime\n\nOutput only. The time this [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s key\nmaterial was generated.\n\n### hasGenerateTime\n\n### clearGenerateTime\n\n### setGenerateTime\n\nOutput only. The time this [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob)'s key\nmaterial was generated.\n\n### getExpireTime\n\nOutput only. The time at which this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) is scheduled for expiration and\ncan no longer be used to import key material.\n\n### hasExpireTime\n\n### clearExpireTime\n\n### setExpireTime\n\nOutput only. The time at which this\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob) is scheduled for expiration and\ncan no longer be used to import key material.\n\n### getExpireEventTime\n\nOutput only. The time this [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob)\nexpired. Only present if [state](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is\n[EXPIRED](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__EXPIRED).\n\n### hasExpireEventTime\n\n### clearExpireEventTime\n\n### setExpireEventTime\n\nOutput only. The time this [ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob)\nexpired. Only present if [state](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is\n[EXPIRED](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__EXPIRED).\n\n### getState\n\nOutput only. The current state of the\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob), indicating if it can be used.\n\n### setState\n\nOutput only. The current state of the\n[ImportJob](/php/docs/reference/cloud-kms/latest/V1.ImportJob), indicating if it can be used.\n\n### getPublicKey\n\nOutput only. The public key with which to wrap key material prior to\nimport. Only returned if [state](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is\n[ACTIVE](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE).\n\n### hasPublicKey\n\n### clearPublicKey\n\n### setPublicKey\n\nOutput only. The public key with which to wrap key material prior to\nimport. Only returned if [state](/php/docs/reference/cloud-kms/latest/V1.ImportJob#_Google_Cloud_Kms_V1_ImportJob__getState__) is\n[ACTIVE](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportJobState#_Google_Cloud_Kms_V1_ImportJob_ImportJobState__ACTIVE).\n\n### getAttestation\n\nOutput only. Statement that was generated and signed by the key creator\n(for example, an HSM) at key creation time. Use this statement to verify\nattributes of the key as stored on the HSM, independently of Google.\n\nOnly present if the chosen\n[ImportMethod](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod) is one with a\nprotection level of [HSM](/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel#_Google_Cloud_Kms_V1_ProtectionLevel__HSM).\n\n### hasAttestation\n\n### clearAttestation\n\n### setAttestation\n\nOutput only. Statement that was generated and signed by the key creator\n(for example, an HSM) at key creation time. Use this statement to verify\nattributes of the key as stored on the HSM, independently of Google.\n\nOnly present if the chosen\n[ImportMethod](/php/docs/reference/cloud-kms/latest/V1.ImportJob.ImportMethod) is one with a\nprotection level of [HSM](/php/docs/reference/cloud-kms/latest/V1.ProtectionLevel#_Google_Cloud_Kms_V1_ProtectionLevel__HSM)."]]