All Products
Search
Document Center

Key Management Service:ExportDataKey

Last Updated:Jun 10, 2026

Mengekspor kunci data yang dienkripsi oleh CMK. Kunci data dienkripsi ulang oleh kunci publik yang Anda tentukan untuk transmisi yang aman.

Deskripsi operasi

Precautions

  • For information about the access policy required for a RAM user or RAM role to use this operation, see Resource Access Management.

  • This operation is accessible through a shared gateway or a dedicated gateway. For more information, see Alibaba Cloud SDK.

    • Shared gateway: You can access KMS using the public endpoint or a VPC endpoint. To use the public endpoint, you must first enable it. For more information, see Access the key in a KMS instance over the Internet.

    • Dedicated gateway: You can access KMS using the private endpoint of the KMS instance: <YOUR_KMS_INSTANCE_ID>.cryptoservice.kms.aliyuncs.com.

Description

After you call the GenerateDataKeyWithoutPlaintext operation to obtain a data key encrypted by a master key (CMK), you can use the ExportDataKey operation to distribute the data key to other regions or cryptographic modules. The ExportDataKey operation returns the ciphertext of the data key, re-encrypted with the specified public key.

You can import the exported ciphertext into the cryptographic module that holds the corresponding private key. This process lets you securely distribute the data key from KMS to a cryptographic module. After the data key is imported into the cryptographic module, you can use it to encrypt or decrypt data.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Parameter permintaan

Parameter

Type

Required

Description

Example

CiphertextBlob

string

Yes

Ciphertext kunci data yang dienkripsi menggunakan customer master key (CMK).

ODZhOWVmZDktM2QxNi00ODk0LWJkNGYtMWZjNDNmM2YyYWJmS7FmDBBQ0BkKsQrtRnidtPwirmDcS0ZuJCU41xxAAWk4Z8qsADfbV0b+i6kQmlvj79dJdGOvtX69Uycs901q********

EncryptionContext

object

No

String JSON yang terdiri dari pasangan kunci-nilai. EncryptionContext adalah konteks enkripsi yang diteruskan saat kunci data dienkripsi menggunakan CMK. Untuk informasi lebih lanjut, lihat EncryptionContext.

{"Example":"Example"}

PublicKeyBlob

string

Yes

Kunci publik dalam format Base64.

MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAndKfC2ReLL2+y8a0+ZBBeAft/uBYo86GZiYJuflqgUzKxpyuvlo3uQkBv6b+nx+0tz8g8v7GhpPWMSW5L9mNHYsvYFsa7jTxsYdt17yj6GlUHPuMIs8hr5qbwl38IHU1iIa7nYWwE2fb3ePOvLDACRJVgGpU0yxioW80d2QD+9aU4jF5dlAahcfgsNzo2CXzCUc1+xbmNuq7Rp+H9VJB9dyYOwqnW3RhOLBo21FzpORapf0UiRlrHRpk1V6ez+aE1dofaYh/9bh0m6ioxj7j5hpZbWccuEZTMBKd+cbuBkRhJzc6Tti6qwZbDiu4fUwbZS0Tqpuo1UadiyxMW********

WrappingKeySpec

string

Yes

Tipe kunci publik yang ditentukan oleh PublicKeyBlob. Untuk informasi lebih lanjut tentang tipe kunci, lihat Pengenalan kunci asimetris.
Nilai valid:

  • RSA_2048

  • EC_SM2.

RSA_2048

WrappingAlgorithm

string

Yes

Algoritma enkripsi yang digunakan untuk mengenkripsi kunci data dengan kunci publik yang ditentukan oleh PublicKeyBlob. Untuk informasi lebih lanjut tentang algoritma, lihat AsymmetricDecrypt.
Nilai valid:

  • RSAES_OAEP_SHA_256

  • RSAES_OAEP_SHA_1

  • SM2PKE.

RSAES_OAEP_SHA_256

DryRun

string

No

Apakah akan mengaktifkan mode DryRun.

  • true

  • false (default)

Mode DryRun digunakan untuk menguji pemanggilan API serta memverifikasi izin pada Sumber daya yang ditentukan dan validitas parameter permintaan. Jika Anda mengaktifkan mode DryRun, KMS mengembalikan tanggapan kegagalan dan alasan kegagalan. Alasan kegagalan mencakup:

  • DryRunOperationError: Permintaan akan berhasil jika parameter DryRun tidak ditentukan.

  • ValidationError: Parameter yang ditentukan di permintaan tidak valid.

  • AccessDeniedError: Anda tidak berwenang untuk melakukan operasi pada Sumber daya KMS.

false

Elemen respons

Element

Type

Description

Example

object

KeyVersionId

string

The ID of the key version that is used to decrypt the ciphertext of the specified data key.

2ab1a983-7072-4bbc-a582-584b5bd8****

KeyId

string

The ID of the CMK that is used to decrypt the ciphertext of the specified data key.
The globally unique identifier of the CMK.

202b9877-5a25-46e3-a763-e20791b5****

RequestId

string

The ID of the request, which is a unique identifier generated by Alibaba Cloud for the request. You can use the request ID to troubleshoot issues.

4bd560a1-729e-45f1-a3d9-b2a33d61046b

ExportedDataKey

string

The exported data key that is protected by public key encryption.

BQKP+1zK6+ZEMxTP5qaVzcsgXtWplYBKm0NXdSnB5FzliFxE1bSiu4dnEIlca2JpeH7yz1/S6fed630H+hIH6DoM25fTLNcKj+mFB0Xnh9m2+HN59Mn4qyTfcUeadnfCXSWcGBouhXFwcdd2rJ3n337bzTf4jm659gZu3L0i6PLuxM9p7mqdwO0cKJPfGVfhnfMz+f4alMg79WB/NNyE2lyX7/qxvV49ObNrrJbKSFiz8Djocaf0IESNLMbfYI5bXjWkJlX92DQbKhibtQW8ZOJ//ZC6t0AWcUoKL6QDm/dg5koQalcleRinpB+QadFm894sLbVZ9+N4GVs*******

Contoh

Respons sukses

JSONformat

{
  "KeyVersionId": "2ab1a983-7072-4bbc-a582-584b5bd8****",
  "KeyId": "202b9877-5a25-46e3-a763-e20791b5****",
  "RequestId": "4bd560a1-729e-45f1-a3d9-b2a33d61046b",
  "ExportedDataKey": "BQKP+1zK6+ZEMxTP5qaVzcsgXtWplYBKm0NXdSnB5FzliFxE1bSiu4dnEIlca2JpeH7yz1/S6fed630H+hIH6DoM25fTLNcKj+mFB0Xnh9m2+HN59Mn4qyTfcUeadnfCXSWcGBouhXFwcdd2rJ3n337bzTf4jm659gZu3L0i6PLuxM9p7mqdwO0cKJPfGVfhnfMz+f4alMg79WB/NNyE2lyX7/qxvV49ObNrrJbKSFiz8Djocaf0IESNLMbfYI5bXjWkJlX92DQbKhibtQW8ZOJ//ZC6t0AWcUoKL6QDm/dg5koQalcleRinpB+QadFm894sLbVZ9+N4GVs*******"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified parameter is not valid. An invalid value is specified for the parameter.
500 InternalFailure Internal Failure.
404 InvalidAccessKeyId.NotFound The Access Key ID provided does not exist in our records.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.