If you want to use your own key material instead of the KMS-generated material, you can use the console to import your key material to KMS. CMKs created using imported material and KMS-generated material are managed together by KMS.
This section describes how to import key material through KMS Console.
Algorithm |
Description |
Configuration |
---|---|---|
RSAES_OAEP_SHA_256 |
RSA encryption algorithm that uses OAEP and has the SHA-256 hash function |
Choose an algorithm from the drop-down list box.
NOTICE:
The RSAES_OAEP_SHA_1 encryption algorithm is no longer secure. Exercise caution when performing this operation. |
RSAES_PKCS1_V1_5 |
RSA encryption algorithm (v1.5) of Public-Key Cryptography Standards number 1 (PKCS #1) |
|
RSAES_OAEP_SHA_1 |
RSA encryption algorithm that uses Optimal Asymmetric Encryption Padding (OAEP) and has the SHA-1 hash function |
The wrapping key and import token expire within 24 hours of creation. If they have expired, download them again.
The following example describes how to obtain the wrapping key and import token of a CMK (ID: 43f1ffd7-18fb-4568-9575-602e009b7ee8; encryption algorithm: RSAES_PKCS1_V1_5).
public_key: The content of the wrapping key (Base-64 encoding) returned after calling the API
import_token: Content of the import token (Base-64 encoding) returned after calling the API
{ "key_id": "43f1ffd7-18fb-4568-9575-602e009b7ee8", "wrapping_algorithm":"RSAES_PKCS1_V1_5" }
{ "key_id": "43f1ffd7-18fb-4568-9575-602e009b7ee8", "public_key":"public key base64 encoded data", "import_token":"import token base64 encoded data", "expiration_time":1501578672 }
openssl enc -d -base64 -A -in PublicKey.b64 -out PublicKey.bin
If you need to run the openssl pkeyutl command, the OpenSSL version must be 1.0.2 or later.
openssl rand -out PlaintextKeyMaterial.bin 32
Replace PublicKey.bin in the command with the name of the wrapping key wrappingKey_key ID_download time downloaded in 10.
Wrapping Key Algorithm |
Key Materials Encryption |
---|---|
RSAES_OAEP_SHA_256 |
openssl pkeyutl -in PlaintextKeyMaterial.bin -inkey PublicKey.bin -out EncryptedKeyMaterial.bin -keyform der -pubin -encrypt -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 |
RSAES_PKCS1_V1_5 |
openssl rsautl -encrypt -in PlaintextKeyMaterial.bin -pkcs -inkey PublicKey.bin -keyform der -pubin -out EncryptedKeyMaterial.bin |
RSAES_OAEP_SHA_1 |
openssl pkeyutl -in PlaintextKeyMaterial.bin -inkey PublicKey.bin -out EncryptedKeyMaterial.bin -keyform der -pubin -encrypt -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha1 |
Parameter |
Description |
---|---|
Key ID |
Random ID of a CMK generated during the CMK creation |
Key material |
|
Parameter |
Description |
---|---|
Key ID |
Random ID of a CMK generated during the CMK creation |
Token |
Select the importToken downloaded in 10. |
Key material expiration mode |
|
Key material can be successfully imported when it matches the corresponding CMK ID and token.
Your imported material is displayed in the list of CMKs. The default status of an imported CMK is Enabled.