가져온 키를 테스트하는 가장 좋은 방법은 키를 가져오기 전에 암호화된 데이터를 복호화하거나 가져온 키를 사용하여 데이터를 암호화하고 가져오기 전에 키를 사용하여 복호화하는 것입니다.
Cloud KMS 또는 Cloud HSM에서는 비대칭 키를 가져오는 경우에만 가능합니다. 이는 대칭 Cloud KMS 또는 Cloud HSM 키를 사용하여 데이터를 암호화하면 암호화 된 데이터와 함께 암호화 키 버전에 대한 추가 메타데이터가 저장되고 암호화되기 때문입니다.
이 메타데이터는 Cloud KMS 외부에서 암호화된 데이터에 없습니다.
증명 확인
Cloud HSM 키에 대한 증명을 확인할 수 있습니다. 이러한 증명은 키가 HSM 키이고, Google에서 HSM 모듈을 소유한다는 점과 키에 관한 기타 세부정보를 확인합니다. 이러한 증명은 소프트웨어 키에 사용할 수 없습니다.
시작하기 전에
Cloud KMS 또는 Cloud HSM으로 비대칭 키 가져오기 키 증명을 확인하려면 Cloud HSM을 사용해야 합니다.
가능하다면 키를 가져온 로컬 시스템을 사용하여 이 주제의 작업을 완료하여 로컬 시스템에 이미 Google Cloud CLI가 설치 및 구성되어 있습니다.
로컬 키를 사용하여 파일을 암호화하거나 해당 키로 암호화된 파일을 로컬 시스템에 복사합니다.
키 자료가 동일한지 확인
비대칭 키를 Cloud KMS 또는 Cloud HSM으로 가져오면 키 자료는 로컬 키와 동일합니다. 이를 확인하려면 가져온 키를 사용하여 가져오기 전에 키를 사용하여 암호화된 데이터를 복호화합니다.
Cloud KMS 또는 Cloud HSM 키를 사용하여 파일을 복호화하려면 다음 안내를 따르세요.
HSM으로 키를 가져온 후 증명을 보고 HSM이 Google 소유인지 여부를 확인할 수 있습니다. 이 절차는 대칭 Cloud HSM 키와 비대칭 키를 확인하는 방법과 다릅니다.
Cloud KMS에서는 소프트웨어 키에 증명을 사용할 수 없습니다.
대칭 Cloud HSM 키
확장 키 체크섬 값(EKCV) 키 속성을 사용하여 가져온 Cloud HSM 키의 키 자료를 확인할 수 있습니다. 이 값은 RFC 5869, 섹션 2에 따라 계산됩니다. 이 값은 0바이트가 32개 있는 SHA-256 기반의 HMAC-based Extract-and-Expand Key Derivation Function(HKDF)을 솔트로 사용하고 고정 문자열 키 확인 값을 정보로 확장하여 도출됩니다. 이 값을 검색하려면 키를 증명합니다.
비대칭 Cloud HSM 키
비대칭 키에 대한 가져오기 요청을 보낼 때 래핑된 비공개 키를 포함합니다. 비공개 키에는 공개 키를 파생하기 위한 Cloud KMS에 대한 충분한 정보가 있습니다. 키를 가져온 후에 공개 키를 검색하여 로컬에 저장한 공개 키와 일치하는지 확인할 수 있습니다. 공개 키 속성 확인에 대한 자세한 내용은 공개 키 확인을 참조하세요.
비대칭 키의 EKCV 인증을 확인할 수 있습니다. 이 경우 값은 DER로 인코딩된 공개 키의 SHA-256 다이제스트입니다. 키 증명을 확인하여 이 값을 검색할 수 있습니다. EKCV 키 속성 확인에 대한 자세한 내용은 키 속성 확인을 참조하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[],[],null,["# Verify an imported key version\n\nThis topic shows you how to verify an asymmetric key version that you\n[import](/kms/docs/importing-a-key) into Cloud KMS or\nCloud HSM.\n\nFor more details about how import works, including limitations and\nrestrictions, refer to [Key import](/kms/docs/key-import).\n\nLimitations on verifying imported keys\n--------------------------------------\n\n### Data encrypted outside of Cloud KMS\n\nThe best way to test an imported key is to decrypt data that was encrypted\nbefore the key was imported, or to encrypt data using the imported key and\ndecrypt it using the key before import.\n\nIn Cloud KMS or Cloud HSM, this is only possible when you\nimport an asymmetric key. This is because when data is encrypted using a\nsymmetric Cloud KMS or Cloud HSM key, extra metadata about\nthe encryption key version is saved, encrypted, along with the encrypted data.\nThis metadata is not present in data encrypted outside of Cloud KMS.\n\n### Verify attestations\n\nYou can [verify attestations](#verifying_attestations) about Cloud HSM\nkeys. These attestations assert that the key is an HSM key, that the HSM module\nis owned by Google, and other details about the key. These attestations are not\navailable for software keys.\n\nBefore you begin\n----------------\n\n- [Import an asymmetric key](/kms/docs/importing-a-key) into Cloud KMS or Cloud HSM. You must use Cloud HSM if you want to verify the key's attestations.\n- If possible, complete the tasks in this topic using the same local system where you imported the key, so the local system already has the Google Cloud CLI installed and configured.\n- Encrypt a file using the local key, or copy a file encrypted with that key to the local system.\n\nVerify that the key material is identical\n-----------------------------------------\n\nAfter you import an asymmetric key into Cloud KMS or\nCloud HSM, the key material is identical to the local key. To verify\nthat this is true, you can use the imported key to decrypt data that was\nencrypted using the key before it was imported.\n\nTo decrypt a file using a Cloud KMS or Cloud HSM key: \n\n```\ngcloud kms decrypt \\\n --location=location \\\n --keyring=key-ring-name \\\n --key=key-name \\\n --ciphertext-file=filepath-and-file-to-decrypt \\\n --plaintext-file=decrypted-filepath-and-file.dec\n```\n\nIf the file pointed to by the `--plaintext-file` flag contains the correct\ndecrypted data, the key material of the external and imported key is identical.\n\nTo learn more, see [encrypting and decrypting data](/kms/docs/encrypt-decrypt).\n\nVerify attestations for a Cloud HSM key\n---------------------------------------\n\nAfter a key is imported into an HSM, you can view attestations to verify that\nthe HSM is owned by Google. The procedure is different to verify\n[symmetric Cloud HSM keys](#verifying_symmetric) and\n[asymmetric keys](#verifying_asymmetric).\n\nAttestations are not available for software keys in Cloud KMS.\n\n### Symmetric Cloud HSM keys\n\nYou can use the Extended Key Checksum Value (EKCV) key attribute to verify an\nimported Cloud HSM key's key material. This value is calculated by\nfollowing [RFC 5869](https://tools.ietf.org/html/rfc5869),\nsection 2. The value is derived using SHA-256-based HMAC-based\nExtract-and-Expand Key Derivation Function (HKDF) with 32 zero bytes as salt and\nexpanding it with the fixed string **Key Check Value** as info. To retrieve this\nvalue, you can [attest the key](/kms/docs/attest-key#verify_key_properties).\n\n### Asymmetric Cloud HSM keys\n\nWhen you make the import request for an asymmetric key, you include your wrapped\nprivate key. The private key contains sufficient information for\nCloud KMS to derive the public key. After your key is imported, you\ncan retrieve the public key and verify that it matches the public key you have\nstored locally. For more information about checking\nthe public key attribute, see\n[To verify the public key](/kms/docs/attest-key#verify_public_key).\n\nYou can verify the EKCV verification for asymmetric keys. In this case, the\nvalue is the SHA-256 digest of the DER-encoded public key. You can retrieve this\nvalue by looking at the attestation of the key. For more information about\nchecking the EKCV key attribute, see\n[To verify key properties](/kms/docs/attest-key#verify_key_properties).\n\nFor additional information about attesting keys you import, see\n[Attesting a key](/kms/docs/attest-key#verify_key_properties)\n\nWhat's next\n-----------\n\n- Learn how to [create keys](/kms/docs/creating-keys)\n- Learn about [encrypting and decrypting](/kms/docs/encrypt-decrypt)\n- Learn about [signing and\n validating data](/kms/docs/create-validate-signatures)"]]