Skip to content

Commit 250fd19

Browse files
author
awstools
committed
feat(client-kms): Added support for the SM2 KeySpec in China Partition Regions
1 parent d790bda commit 250fd19

21 files changed

+409
-122
lines changed

clients/client-kms/src/KMS.ts

Lines changed: 49 additions & 27 deletions
Large diffs are not rendered by default.

clients/client-kms/src/commands/CreateCustomKeyStoreCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface CreateCustomKeyStoreCommandOutput extends CreateCustomKeyStoreR
2525
/**
2626
* <p>Creates a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a> that is associated with an <a href="https://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html">CloudHSM cluster</a> that you own and
2727
* manage.</p>
28-
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">Custom Key Store feature</a> feature in KMS, which
28+
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store feature</a> feature in KMS, which
2929
* combines the convenience and extensive integration of KMS with the isolation and control of a
3030
* single-tenant key store.</p>
3131
* <p>Before you create the custom key store, you must assemble

clients/client-kms/src/commands/CreateKeyCommand.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export interface CreateKeyCommandOutput extends CreateKeyResponse, __MetadataBea
3434
* <dd>
3535
* <p>To create a symmetric encryption KMS key, you aren't required to specify any parameters. The default value for
3636
* <code>KeySpec</code>, <code>SYMMETRIC_DEFAULT</code>, and the default value for
37-
* <code>KeyUsage</code>, <code>ENCRYPT_DECRYPT</code>, create a symmetric encryption KMS key.</p>
37+
* <code>KeyUsage</code>, <code>ENCRYPT_DECRYPT</code>, create a symmetric encryption KMS key. For technical details, see
38+
* <a href="https://docs.aws.amazon.com/kms/latest/developerguide/asymmetric-key-specs.html#key-spec-symmetric-default">
39+
* SYMMETRIC_DEFAULT key spec</a> in the <i>Key Management Service Developer Guide</i>.</p>
3840
* <p>If you need a key for basic encryption and decryption or you
3941
* are creating a KMS key to protect your resources in an Amazon Web Services service, create a symmetric encryption KMS key. The key material in a symmetric encryption key never leaves KMS unencrypted. You can use a symmetric encryption KMS key to encrypt and decrypt data up to 4,096 bytes, but they are typically used to generate data keys and data keys pairs. For details, see <a>GenerateDataKey</a> and <a>GenerateDataKeyPair</a>.</p>
4042
* <p> </p>
@@ -45,9 +47,9 @@ export interface CreateKeyCommandOutput extends CreateKeyResponse, __MetadataBea
4547
* the type of key material in the KMS key. Then, use the <code>KeyUsage</code> parameter
4648
* to determine whether the KMS key will be used to encrypt and decrypt or sign and verify.
4749
* You can't change these properties after the KMS key is created.</p>
48-
* <p>Asymmetric KMS keys contain an RSA key pair or an Elliptic Curve (ECC) key pair. The private key in an asymmetric
50+
* <p>Asymmetric KMS keys contain an RSA key pair, Elliptic Curve (ECC) key pair, or an SM2 key pair (China Regions only). The private key in an asymmetric
4951
* KMS key never leaves KMS unencrypted. However, you can use the <a>GetPublicKey</a> operation to download the public key
50-
* so it can be used outside of KMS. KMS keys with RSA key pairs can be used to encrypt or decrypt data or sign and verify messages (but not both).
52+
* so it can be used outside of KMS. KMS keys with RSA or SM2 key pairs can be used to encrypt or decrypt data or sign and verify messages (but not both).
5153
* KMS keys with ECC key pairs can be used only to sign and verify messages.
5254
* For information about asymmetric KMS keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html">Asymmetric KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
5355
* <p> </p>

clients/client-kms/src/commands/DeleteCustomKeyStoreCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface DeleteCustomKeyStoreCommandOutput extends DeleteCustomKeyStoreR
2525
/**
2626
* <p>Deletes a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store</a>. This operation does not delete the CloudHSM cluster that is
2727
* associated with the custom key store, or affect any users or keys in the cluster.</p>
28-
* <p>The custom key store that you delete cannot contain any KMS <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys">KMS keys</a>. Before deleting the key store,
28+
* <p>The custom key store that you delete cannot contain any <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys">KMS keys</a>. Before deleting the key store,
2929
* verify that you will never need to use any of the KMS keys in the key store for any
3030
* <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations">cryptographic operations</a>. Then, use <a>ScheduleKeyDeletion</a> to delete the KMS keys from the
3131
* key store. When the scheduled waiting period expires, the <code>ScheduleKeyDeletion</code>
@@ -39,7 +39,7 @@ export interface DeleteCustomKeyStoreCommandOutput extends DeleteCustomKeyStoreR
3939
* delete KMS keys and you can reconnect a disconnected custom key store at any time.</p>
4040
* <p>If the operation succeeds, it returns a JSON object with no
4141
* properties.</p>
42-
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">Custom Key Store feature</a> feature in KMS, which
42+
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store feature</a> feature in KMS, which
4343
* combines the convenience and extensive integration of KMS with the isolation and control of a
4444
* single-tenant key store.</p>
4545
* <p>

clients/client-kms/src/commands/DescribeCustomKeyStoresCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface DescribeCustomKeyStoresCommandOutput extends DescribeCustomKeyS
2424

2525
/**
2626
* <p>Gets information about <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key stores</a> in the account and Region.</p>
27-
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">Custom Key Store feature</a> feature in KMS, which
27+
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store feature</a> feature in KMS, which
2828
* combines the convenience and extensive integration of KMS with the isolation and control of a
2929
* single-tenant key store.</p>
3030
* <p>By default, this operation returns information about all custom key

clients/client-kms/src/commands/DescribeKeyCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface DescribeKeyCommandOutput extends DescribeKeyResponse, __Metadat
4141
* <p>Whether automatic key rotation is enabled on the KMS key. To get this information, use
4242
* <a>GetKeyRotationStatus</a>. Also, some key states prevent a KMS key from
4343
* being automatically rotated. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works">How Automatic Key Rotation
44-
* Works</a> in <i>Key Management Service Developer Guide</i>.</p>
44+
* Works</a> in the <i>Key Management Service Developer Guide</i>.</p>
4545
* </li>
4646
* <li>
4747
* <p>Tags on the KMS key. To get this information, use <a>ListResourceTags</a>.</p>

clients/client-kms/src/commands/DisconnectCustomKeyStoreCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface DisconnectCustomKeyStoreCommandOutput extends DisconnectCustomK
3636
* <a>ConnectCustomKeyStore</a> operation.</p>
3737
* <p>If the operation succeeds, it returns a JSON object with no
3838
* properties.</p>
39-
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">Custom Key Store feature</a> feature in KMS, which
39+
* <p>This operation is part of the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html">custom key store feature</a> feature in KMS, which
4040
* combines the convenience and extensive integration of KMS with the isolation and control of a
4141
* single-tenant key store.</p>
4242
*

clients/client-kms/src/commands/EncryptCommand.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface EncryptCommandOutput extends EncryptResponse, __MetadataBearer
3333
* <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption
3434
* Context</a> in the <i>Key Management Service Developer Guide</i>.</p>
3535
* <p>If you specify an asymmetric KMS key, you must also specify the encryption algorithm. The
36-
* algorithm must be compatible with the KMS key type.</p>
36+
* algorithm must be compatible with the KMS key spec.</p>
3737
* <important>
3838
* <p>When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.</p>
3939
* <p>You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric encryption KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.</p>
@@ -97,6 +97,10 @@ export interface EncryptCommandOutput extends EncryptResponse, __MetadataBearer
9797
* </li>
9898
* </ul>
9999
* </li>
100+
* <li>
101+
* <p>
102+
* <code>SM2PKE</code>: 1024 bytes (China Regions only)</p>
103+
* </li>
100104
* </ul>
101105
* <p>The KMS key that you use for this operation must be in a compatible key state. For
102106
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>

clients/client-kms/src/commands/GenerateDataKeyCommand.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ export interface GenerateDataKeyCommandOutput extends GenerateDataKeyResponse, _
2525
/**
2626
* <p>Returns a unique symmetric data key for use outside of KMS. This operation returns a
2727
* plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS
28-
* key that you specify. The bytes in the plaintext key are random; they are not related to the caller or the KMS
29-
* key. You can use the plaintext key to encrypt your data outside of KMS and store the encrypted
30-
* data key with the encrypted data.</p>
28+
* key that you specify. The bytes in the plaintext key are random; they are not related
29+
* to the caller or the KMS key. You can use the plaintext key to encrypt your data outside of KMS
30+
* and store the encrypted data key with the encrypted data.</p>
3131
*
3232
* <p>To generate a data key, specify the symmetric encryption KMS key that will be used to
3333
* encrypt the data key. You cannot use an asymmetric KMS key to encrypt data keys. To get the
34-
* type of your KMS key, use the <a>DescribeKey</a> operation. You must also specify the length of
35-
* the data key. Use either the <code>KeySpec</code> or <code>NumberOfBytes</code> parameters
36-
* (but not both). For 128-bit and 256-bit data keys, use the <code>KeySpec</code> parameter. </p>
34+
* type of your KMS key, use the <a>DescribeKey</a> operation.</p>
35+
*
36+
* <p>You must also specify the length of the data key. Use either the <code>KeySpec</code> or
37+
* <code>NumberOfBytes</code> parameters (but not both). For 128-bit and 256-bit data keys, use
38+
* the <code>KeySpec</code> parameter.</p>
39+
*
40+
* <p>To generate an SM4 data key (China Regions only), specify a <code>KeySpec</code> value of
41+
* <code>AES_128</code> or <code>NumberOfBytes</code> value of <code>128</code>. The symmetric
42+
* encryption key used in China Regions to encrypt your data key is an SM4 encryption key.</p>
3743
*
3844
* <p>To get only an encrypted copy of the data key, use <a>GenerateDataKeyWithoutPlaintext</a>. To generate an asymmetric data key pair, use
3945
* the <a>GenerateDataKeyPair</a> or <a>GenerateDataKeyPairWithoutPlaintext</a> operation. To get a cryptographically secure

clients/client-kms/src/commands/GenerateDataKeyPairCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export interface GenerateDataKeyPairCommandOutput extends GenerateDataKeyPairRes
3939
* custom key store. To get the type and origin of your KMS key, use the <a>DescribeKey</a>
4040
* operation. </p>
4141
* <p>Use the <code>KeyPairSpec</code> parameter to choose an RSA or Elliptic Curve (ECC) data
42-
* key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for
43-
* either encryption or signing, but not both. However, KMS cannot enforce any restrictions on
44-
* the use of data key pairs outside of KMS.</p>
42+
* key pair. In China Regions, you can also choose an SM2 data key pair. KMS recommends that you use
43+
* ECC key pairs for signing, and use RSA and SM2 key pairs for either encryption or signing, but not both.
44+
* However, KMS cannot enforce any restrictions on the use of data key pairs outside of KMS.</p>
4545
*
4646
* <p>If you are using the data key pair to encrypt data, or for any operation where you don't
4747
* immediately need a private key, consider using the <a>GenerateDataKeyPairWithoutPlaintext</a> operation.

0 commit comments

Comments
 (0)