@aws-sdk/client-kms 3.36.0 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/dist-cjs/KMS.js +0 -92
- package/dist-cjs/KMSClient.js +0 -97
- package/dist-cjs/commands/CancelKeyDeletionCommand.js +0 -37
- package/dist-cjs/commands/ConnectCustomKeyStoreCommand.js +0 -85
- package/dist-cjs/commands/CreateAliasCommand.js +0 -81
- package/dist-cjs/commands/CreateCustomKeyStoreCommand.js +0 -73
- package/dist-cjs/commands/CreateGrantCommand.js +0 -86
- package/dist-cjs/commands/CreateKeyCommand.js +0 -148
- package/dist-cjs/commands/DecryptCommand.js +0 -112
- package/dist-cjs/commands/DeleteAliasCommand.js +0 -71
- package/dist-cjs/commands/DeleteCustomKeyStoreCommand.js +0 -78
- package/dist-cjs/commands/DeleteImportedKeyMaterialCommand.js +0 -53
- package/dist-cjs/commands/DescribeCustomKeyStoresCommand.js +0 -77
- package/dist-cjs/commands/DescribeKeyCommand.js +0 -103
- package/dist-cjs/commands/DisableKeyCommand.js +0 -39
- package/dist-cjs/commands/DisableKeyRotationCommand.js +0 -49
- package/dist-cjs/commands/DisconnectCustomKeyStoreCommand.js +0 -76
- package/dist-cjs/commands/EnableKeyCommand.js +0 -36
- package/dist-cjs/commands/EnableKeyRotationCommand.js +0 -49
- package/dist-cjs/commands/EncryptCommand.js +0 -148
- package/dist-cjs/commands/GenerateDataKeyCommand.js +0 -121
- package/dist-cjs/commands/GenerateDataKeyPairCommand.js +0 -100
- package/dist-cjs/commands/GenerateDataKeyPairWithoutPlaintextCommand.js +0 -90
- package/dist-cjs/commands/GenerateDataKeyWithoutPlaintextCommand.js +0 -95
- package/dist-cjs/commands/GenerateRandomCommand.js +0 -33
- package/dist-cjs/commands/GetKeyPolicyCommand.js +0 -32
- package/dist-cjs/commands/GetKeyRotationStatusCommand.js +0 -61
- package/dist-cjs/commands/GetParametersForImportCommand.js +0 -58
- package/dist-cjs/commands/GetPublicKeyCommand.js +0 -70
- package/dist-cjs/commands/ImportKeyMaterialCommand.js +0 -87
- package/dist-cjs/commands/ListAliasesCommand.js +0 -66
- package/dist-cjs/commands/ListGrantsCommand.js +0 -69
- package/dist-cjs/commands/ListKeyPoliciesCommand.js +0 -46
- package/dist-cjs/commands/ListKeysCommand.js +0 -54
- package/dist-cjs/commands/ListResourceTagsCommand.js +0 -58
- package/dist-cjs/commands/ListRetirableGrantsCommand.js +0 -67
- package/dist-cjs/commands/PutKeyPolicyCommand.js +0 -37
- package/dist-cjs/commands/ReEncryptCommand.js +0 -122
- package/dist-cjs/commands/ReplicateKeyCommand.js +0 -101
- package/dist-cjs/commands/RetireGrantCommand.js +0 -70
- package/dist-cjs/commands/RevokeGrantCommand.js +0 -67
- package/dist-cjs/commands/ScheduleKeyDeletionCommand.js +0 -78
- package/dist-cjs/commands/SignCommand.js +0 -69
- package/dist-cjs/commands/TagResourceCommand.js +0 -71
- package/dist-cjs/commands/UntagResourceCommand.js +0 -67
- package/dist-cjs/commands/UpdateAliasCommand.js +0 -86
- package/dist-cjs/commands/UpdateCustomKeyStoreCommand.js +0 -96
- package/dist-cjs/commands/UpdateKeyDescriptionCommand.js +0 -47
- package/dist-cjs/commands/UpdatePrimaryRegionCommand.js +0 -89
- package/dist-cjs/commands/VerifyCommand.js +0 -54
- package/dist-cjs/commands/index.js +51 -0
- package/dist-cjs/endpoints.js +6 -1
- package/dist-cjs/index.js +4 -55
- package/dist-cjs/models/models_0.js +0 -366
- package/dist-cjs/pagination/ListAliasesPaginator.js +0 -10
- package/dist-cjs/pagination/ListGrantsPaginator.js +0 -10
- package/dist-cjs/pagination/ListKeyPoliciesPaginator.js +0 -10
- package/dist-cjs/pagination/ListKeysPaginator.js +0 -10
- package/dist-cjs/pagination/index.js +8 -0
- package/dist-cjs/protocols/Aws_json1_1.js +0 -5
- package/dist-cjs/runtimeConfig.browser.js +1 -5
- package/dist-cjs/runtimeConfig.js +1 -5
- package/dist-cjs/runtimeConfig.native.js +0 -3
- package/dist-cjs/runtimeConfig.shared.js +0 -3
- package/dist-es/commands/index.js +48 -0
- package/dist-es/endpoints.js +6 -1
- package/dist-es/index.js +4 -55
- package/dist-es/pagination/index.js +5 -0
- package/dist-types/commands/index.d.ts +48 -0
- package/dist-types/index.d.ts +4 -55
- package/dist-types/pagination/index.d.ts +5 -0
- package/dist-types/ts3.4/KMS.d.ts +49 -2646
- package/dist-types/ts3.4/KMSClient.d.ts +24 -178
- package/dist-types/ts3.4/commands/CancelKeyDeletionCommand.d.ts +2 -33
- package/dist-types/ts3.4/commands/ConnectCustomKeyStoreCommand.d.ts +2 -81
- package/dist-types/ts3.4/commands/CreateAliasCommand.d.ts +2 -77
- package/dist-types/ts3.4/commands/CreateCustomKeyStoreCommand.d.ts +2 -69
- package/dist-types/ts3.4/commands/CreateGrantCommand.d.ts +2 -82
- package/dist-types/ts3.4/commands/CreateKeyCommand.d.ts +2 -144
- package/dist-types/ts3.4/commands/DecryptCommand.d.ts +2 -108
- package/dist-types/ts3.4/commands/DeleteAliasCommand.d.ts +2 -67
- package/dist-types/ts3.4/commands/DeleteCustomKeyStoreCommand.d.ts +2 -74
- package/dist-types/ts3.4/commands/DeleteImportedKeyMaterialCommand.d.ts +2 -49
- package/dist-types/ts3.4/commands/DescribeCustomKeyStoresCommand.d.ts +2 -73
- package/dist-types/ts3.4/commands/DescribeKeyCommand.d.ts +2 -99
- package/dist-types/ts3.4/commands/DisableKeyCommand.d.ts +2 -35
- package/dist-types/ts3.4/commands/DisableKeyRotationCommand.d.ts +2 -45
- package/dist-types/ts3.4/commands/DisconnectCustomKeyStoreCommand.d.ts +2 -72
- package/dist-types/ts3.4/commands/EnableKeyCommand.d.ts +2 -32
- package/dist-types/ts3.4/commands/EnableKeyRotationCommand.d.ts +2 -45
- package/dist-types/ts3.4/commands/EncryptCommand.d.ts +2 -144
- package/dist-types/ts3.4/commands/GenerateDataKeyCommand.d.ts +2 -117
- package/dist-types/ts3.4/commands/GenerateDataKeyPairCommand.d.ts +2 -96
- package/dist-types/ts3.4/commands/GenerateDataKeyPairWithoutPlaintextCommand.d.ts +2 -86
- package/dist-types/ts3.4/commands/GenerateDataKeyWithoutPlaintextCommand.d.ts +2 -91
- package/dist-types/ts3.4/commands/GenerateRandomCommand.d.ts +2 -29
- package/dist-types/ts3.4/commands/GetKeyPolicyCommand.d.ts +2 -28
- package/dist-types/ts3.4/commands/GetKeyRotationStatusCommand.d.ts +2 -57
- package/dist-types/ts3.4/commands/GetParametersForImportCommand.d.ts +2 -54
- package/dist-types/ts3.4/commands/GetPublicKeyCommand.d.ts +2 -66
- package/dist-types/ts3.4/commands/ImportKeyMaterialCommand.d.ts +2 -83
- package/dist-types/ts3.4/commands/ListAliasesCommand.d.ts +2 -62
- package/dist-types/ts3.4/commands/ListGrantsCommand.d.ts +2 -65
- package/dist-types/ts3.4/commands/ListKeyPoliciesCommand.d.ts +2 -42
- package/dist-types/ts3.4/commands/ListKeysCommand.d.ts +2 -50
- package/dist-types/ts3.4/commands/ListResourceTagsCommand.d.ts +2 -54
- package/dist-types/ts3.4/commands/ListRetirableGrantsCommand.d.ts +2 -63
- package/dist-types/ts3.4/commands/PutKeyPolicyCommand.d.ts +2 -33
- package/dist-types/ts3.4/commands/ReEncryptCommand.d.ts +2 -118
- package/dist-types/ts3.4/commands/ReplicateKeyCommand.d.ts +2 -97
- package/dist-types/ts3.4/commands/RetireGrantCommand.d.ts +2 -66
- package/dist-types/ts3.4/commands/RevokeGrantCommand.d.ts +2 -63
- package/dist-types/ts3.4/commands/ScheduleKeyDeletionCommand.d.ts +2 -74
- package/dist-types/ts3.4/commands/SignCommand.d.ts +2 -65
- package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +2 -67
- package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +2 -63
- package/dist-types/ts3.4/commands/UpdateAliasCommand.d.ts +2 -82
- package/dist-types/ts3.4/commands/UpdateCustomKeyStoreCommand.d.ts +2 -92
- package/dist-types/ts3.4/commands/UpdateKeyDescriptionCommand.d.ts +2 -43
- package/dist-types/ts3.4/commands/UpdatePrimaryRegionCommand.d.ts +2 -85
- package/dist-types/ts3.4/commands/VerifyCommand.d.ts +2 -50
- package/dist-types/ts3.4/commands/index.d.ts +48 -0
- package/dist-types/ts3.4/index.d.ts +4 -55
- package/dist-types/ts3.4/models/models_0.d.ts +445 -2963
- package/dist-types/ts3.4/pagination/index.d.ts +5 -0
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
- package/package.json +32 -32
|
@@ -5,159 +5,11 @@ const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const models_0_1 = require("../models/models_0");
|
|
7
7
|
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
-
/**
|
|
9
|
-
* <p>Encrypts plaintext into ciphertext by using a KMS key. The <code>Encrypt</code> operation
|
|
10
|
-
* has two primary use cases:</p>
|
|
11
|
-
* <ul>
|
|
12
|
-
* <li>
|
|
13
|
-
* <p>You can encrypt small amounts of arbitrary data, such as a personal identifier or
|
|
14
|
-
* database password, or other sensitive information. </p>
|
|
15
|
-
* </li>
|
|
16
|
-
* <li>
|
|
17
|
-
* <p>You can use the <code>Encrypt</code> operation to move encrypted data from one Amazon Web Services
|
|
18
|
-
* Region to another. For example, in Region A, generate a data key and use the plaintext key
|
|
19
|
-
* to encrypt your data. Then, in Region A, use the <code>Encrypt</code> operation to encrypt
|
|
20
|
-
* the plaintext data key under a KMS key in Region B. Now, you can move the encrypted data
|
|
21
|
-
* and the encrypted data key to Region B. When necessary, you can decrypt the encrypted data
|
|
22
|
-
* key and the encrypted data entirely within in Region B.</p>
|
|
23
|
-
* </li>
|
|
24
|
-
* </ul>
|
|
25
|
-
*
|
|
26
|
-
* <p>You don't need to use the <code>Encrypt</code> operation to encrypt a data key. The <a>GenerateDataKey</a> and <a>GenerateDataKeyPair</a> operations return a
|
|
27
|
-
* plaintext data key and an encrypted copy of that data key.</p>
|
|
28
|
-
*
|
|
29
|
-
* <p>When you encrypt data, you must specify a symmetric or asymmetric KMS key to use in the
|
|
30
|
-
* encryption operation. The KMS key must have a <code>KeyUsage</code> value of
|
|
31
|
-
* <code>ENCRYPT_DECRYPT.</code> To find the <code>KeyUsage</code> of a KMS key, use the <a>DescribeKey</a> operation. </p>
|
|
32
|
-
*
|
|
33
|
-
* <p>If you use a symmetric KMS key, you can use an encryption context to add additional
|
|
34
|
-
* security to your encryption operation. If you specify an <code>EncryptionContext</code> when
|
|
35
|
-
* encrypting data, you must specify the same encryption context (a case-sensitive exact match)
|
|
36
|
-
* when decrypting the data. Otherwise, the request to decrypt fails with an
|
|
37
|
-
* <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption
|
|
38
|
-
* Context</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
39
|
-
* <p>If you specify an asymmetric KMS key, you must also specify the encryption algorithm. The
|
|
40
|
-
* algorithm must be compatible with the KMS key type.</p>
|
|
41
|
-
* <important>
|
|
42
|
-
* <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>
|
|
43
|
-
* <p>You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric 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>
|
|
44
|
-
* </important>
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* <p>The maximum size of the data that you can encrypt varies with the type of KMS key and the
|
|
48
|
-
* encryption algorithm that you choose.</p>
|
|
49
|
-
* <ul>
|
|
50
|
-
* <li>
|
|
51
|
-
* <p>Symmetric KMS keys</p>
|
|
52
|
-
* <ul>
|
|
53
|
-
* <li>
|
|
54
|
-
* <p>
|
|
55
|
-
* <code>SYMMETRIC_DEFAULT</code>: 4096 bytes</p>
|
|
56
|
-
* </li>
|
|
57
|
-
* </ul>
|
|
58
|
-
* </li>
|
|
59
|
-
* <li>
|
|
60
|
-
* <p>
|
|
61
|
-
* <code>RSA_2048</code>
|
|
62
|
-
* </p>
|
|
63
|
-
* <ul>
|
|
64
|
-
* <li>
|
|
65
|
-
* <p>
|
|
66
|
-
* <code>RSAES_OAEP_SHA_1</code>: 214 bytes</p>
|
|
67
|
-
* </li>
|
|
68
|
-
* <li>
|
|
69
|
-
* <p>
|
|
70
|
-
* <code>RSAES_OAEP_SHA_256</code>: 190 bytes</p>
|
|
71
|
-
* </li>
|
|
72
|
-
* </ul>
|
|
73
|
-
* </li>
|
|
74
|
-
* <li>
|
|
75
|
-
* <p>
|
|
76
|
-
* <code>RSA_3072</code>
|
|
77
|
-
* </p>
|
|
78
|
-
* <ul>
|
|
79
|
-
* <li>
|
|
80
|
-
* <p>
|
|
81
|
-
* <code>RSAES_OAEP_SHA_1</code>: 342 bytes</p>
|
|
82
|
-
* </li>
|
|
83
|
-
* <li>
|
|
84
|
-
* <p>
|
|
85
|
-
* <code>RSAES_OAEP_SHA_256</code>: 318 bytes</p>
|
|
86
|
-
* </li>
|
|
87
|
-
* </ul>
|
|
88
|
-
* </li>
|
|
89
|
-
* <li>
|
|
90
|
-
* <p>
|
|
91
|
-
* <code>RSA_4096</code>
|
|
92
|
-
* </p>
|
|
93
|
-
* <ul>
|
|
94
|
-
* <li>
|
|
95
|
-
* <p>
|
|
96
|
-
* <code>RSAES_OAEP_SHA_1</code>: 470 bytes</p>
|
|
97
|
-
* </li>
|
|
98
|
-
* <li>
|
|
99
|
-
* <p>
|
|
100
|
-
* <code>RSAES_OAEP_SHA_256</code>: 446 bytes</p>
|
|
101
|
-
* </li>
|
|
102
|
-
* </ul>
|
|
103
|
-
* </li>
|
|
104
|
-
* </ul>
|
|
105
|
-
* <p>The KMS key that you use for this operation must be in a compatible key state. For
|
|
106
|
-
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
107
|
-
* <p>
|
|
108
|
-
* <b>Cross-account use</b>: Yes.
|
|
109
|
-
* To perform this operation with a KMS key in a different Amazon Web Services account, specify
|
|
110
|
-
* the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
|
|
111
|
-
*
|
|
112
|
-
* <p>
|
|
113
|
-
* <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:Encrypt</a> (key policy)</p>
|
|
114
|
-
* <p>
|
|
115
|
-
* <b>Related operations:</b>
|
|
116
|
-
* </p>
|
|
117
|
-
* <ul>
|
|
118
|
-
* <li>
|
|
119
|
-
* <p>
|
|
120
|
-
* <a>Decrypt</a>
|
|
121
|
-
* </p>
|
|
122
|
-
* </li>
|
|
123
|
-
* <li>
|
|
124
|
-
* <p>
|
|
125
|
-
* <a>GenerateDataKey</a>
|
|
126
|
-
* </p>
|
|
127
|
-
* </li>
|
|
128
|
-
* <li>
|
|
129
|
-
* <p>
|
|
130
|
-
* <a>GenerateDataKeyPair</a>
|
|
131
|
-
* </p>
|
|
132
|
-
* </li>
|
|
133
|
-
* </ul>
|
|
134
|
-
* @example
|
|
135
|
-
* Use a bare-bones client and the command you need to make an API call.
|
|
136
|
-
* ```javascript
|
|
137
|
-
* import { KMSClient, EncryptCommand } from "@aws-sdk/client-kms"; // ES Modules import
|
|
138
|
-
* // const { KMSClient, EncryptCommand } = require("@aws-sdk/client-kms"); // CommonJS import
|
|
139
|
-
* const client = new KMSClient(config);
|
|
140
|
-
* const command = new EncryptCommand(input);
|
|
141
|
-
* const response = await client.send(command);
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* @see {@link EncryptCommandInput} for command's `input` shape.
|
|
145
|
-
* @see {@link EncryptCommandOutput} for command's `response` shape.
|
|
146
|
-
* @see {@link KMSClientResolvedConfig | config} for command's `input` shape.
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
8
|
class EncryptCommand extends smithy_client_1.Command {
|
|
150
|
-
// Start section: command_properties
|
|
151
|
-
// End section: command_properties
|
|
152
9
|
constructor(input) {
|
|
153
|
-
// Start section: command_constructor
|
|
154
10
|
super();
|
|
155
11
|
this.input = input;
|
|
156
|
-
// End section: command_constructor
|
|
157
12
|
}
|
|
158
|
-
/**
|
|
159
|
-
* @internal
|
|
160
|
-
*/
|
|
161
13
|
resolveMiddleware(clientStack, configuration, options) {
|
|
162
14
|
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
163
15
|
const stack = clientStack.concat(this.middlewareStack);
|
|
@@ -5,132 +5,11 @@ const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const models_0_1 = require("../models/models_0");
|
|
7
7
|
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
-
/**
|
|
9
|
-
* <p>Generates a unique symmetric data key for client-side encryption. This operation returns a
|
|
10
|
-
* plaintext copy of the data key and a copy that is encrypted under a KMS key that you specify.
|
|
11
|
-
* You can use the plaintext key to encrypt your data outside of KMS and store the encrypted
|
|
12
|
-
* data key with the encrypted data.</p>
|
|
13
|
-
*
|
|
14
|
-
* <p>
|
|
15
|
-
* <code>GenerateDataKey</code> returns a unique data key for each request. The bytes in the
|
|
16
|
-
* plaintext key are not related to the caller or the KMS key.</p>
|
|
17
|
-
*
|
|
18
|
-
* <p>To generate a data key, specify the symmetric KMS key that will be used to encrypt the
|
|
19
|
-
* data key. You cannot use an asymmetric KMS key to generate data keys. To get the type of your
|
|
20
|
-
* KMS key, use the <a>DescribeKey</a> operation. You must also specify the length of
|
|
21
|
-
* the data key. Use either the <code>KeySpec</code> or <code>NumberOfBytes</code> parameters
|
|
22
|
-
* (but not both). For 128-bit and 256-bit data keys, use the <code>KeySpec</code> parameter. </p>
|
|
23
|
-
*
|
|
24
|
-
* <p>To get only an encrypted copy of the data key, use <a>GenerateDataKeyWithoutPlaintext</a>. To generate an asymmetric data key pair, use
|
|
25
|
-
* the <a>GenerateDataKeyPair</a> or <a>GenerateDataKeyPairWithoutPlaintext</a> operation. To get a cryptographically secure
|
|
26
|
-
* random byte string, use <a>GenerateRandom</a>.</p>
|
|
27
|
-
*
|
|
28
|
-
* <p>You can use the optional encryption context to add additional security to the encryption
|
|
29
|
-
* operation. If you specify an <code>EncryptionContext</code>, you must specify the same
|
|
30
|
-
* encryption context (a case-sensitive exact match) when decrypting the encrypted data key.
|
|
31
|
-
* Otherwise, the request to decrypt fails with an <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption Context</a> in the
|
|
32
|
-
* <i>Key Management Service Developer Guide</i>.</p>
|
|
33
|
-
* <p>Applications in Amazon Web Services Nitro Enclaves can call this operation by using the <a href="https://github.com/aws/aws-nitro-enclaves-sdk-c">Amazon Web Services Nitro Enclaves Development Kit</a>. For information about the supporting parameters, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html">How Amazon Web Services Nitro Enclaves use KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
34
|
-
* <p>The KMS key that you use for this operation must be in a compatible key state. For
|
|
35
|
-
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
36
|
-
* <p>
|
|
37
|
-
* <b>How to use your data
|
|
38
|
-
* key</b>
|
|
39
|
-
* </p>
|
|
40
|
-
* <p>We recommend that you use the following pattern to encrypt data locally in your
|
|
41
|
-
* application. You can write your own code or use a client-side encryption library, such as the
|
|
42
|
-
* <a href="https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/">Amazon Web Services Encryption SDK</a>, the
|
|
43
|
-
* <a href="https://docs.aws.amazon.com/dynamodb-encryption-client/latest/devguide/">Amazon DynamoDB Encryption Client</a>,
|
|
44
|
-
* or <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html">Amazon S3
|
|
45
|
-
* client-side encryption</a> to do these tasks for you.</p>
|
|
46
|
-
* <p>To encrypt data outside of KMS:</p>
|
|
47
|
-
* <ol>
|
|
48
|
-
* <li>
|
|
49
|
-
* <p>Use the <code>GenerateDataKey</code> operation to get a data key.</p>
|
|
50
|
-
* </li>
|
|
51
|
-
* <li>
|
|
52
|
-
* <p>Use the plaintext data key (in the <code>Plaintext</code> field of the response) to
|
|
53
|
-
* encrypt your data outside of KMS. Then erase the plaintext data key from memory.</p>
|
|
54
|
-
* </li>
|
|
55
|
-
* <li>
|
|
56
|
-
* <p>Store the encrypted data key (in the <code>CiphertextBlob</code> field of the
|
|
57
|
-
* response) with the encrypted data.</p>
|
|
58
|
-
* </li>
|
|
59
|
-
* </ol>
|
|
60
|
-
* <p>To decrypt data outside of KMS:</p>
|
|
61
|
-
* <ol>
|
|
62
|
-
* <li>
|
|
63
|
-
* <p>Use the <a>Decrypt</a> operation to decrypt the encrypted data key. The
|
|
64
|
-
* operation returns a plaintext copy of the data key.</p>
|
|
65
|
-
* </li>
|
|
66
|
-
* <li>
|
|
67
|
-
* <p>Use the plaintext data key to decrypt data outside of KMS, then erase the plaintext
|
|
68
|
-
* data key from memory.</p>
|
|
69
|
-
* </li>
|
|
70
|
-
* </ol>
|
|
71
|
-
* <p>
|
|
72
|
-
* <b>Cross-account use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify
|
|
73
|
-
* the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
|
|
74
|
-
*
|
|
75
|
-
* <p>
|
|
76
|
-
* <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:GenerateDataKey</a> (key policy)</p>
|
|
77
|
-
* <p>
|
|
78
|
-
* <b>Related operations:</b>
|
|
79
|
-
* </p>
|
|
80
|
-
* <ul>
|
|
81
|
-
* <li>
|
|
82
|
-
* <p>
|
|
83
|
-
* <a>Decrypt</a>
|
|
84
|
-
* </p>
|
|
85
|
-
* </li>
|
|
86
|
-
* <li>
|
|
87
|
-
* <p>
|
|
88
|
-
* <a>Encrypt</a>
|
|
89
|
-
* </p>
|
|
90
|
-
* </li>
|
|
91
|
-
* <li>
|
|
92
|
-
* <p>
|
|
93
|
-
* <a>GenerateDataKeyPair</a>
|
|
94
|
-
* </p>
|
|
95
|
-
* </li>
|
|
96
|
-
* <li>
|
|
97
|
-
* <p>
|
|
98
|
-
* <a>GenerateDataKeyPairWithoutPlaintext</a>
|
|
99
|
-
* </p>
|
|
100
|
-
* </li>
|
|
101
|
-
* <li>
|
|
102
|
-
* <p>
|
|
103
|
-
* <a>GenerateDataKeyWithoutPlaintext</a>
|
|
104
|
-
* </p>
|
|
105
|
-
* </li>
|
|
106
|
-
* </ul>
|
|
107
|
-
* @example
|
|
108
|
-
* Use a bare-bones client and the command you need to make an API call.
|
|
109
|
-
* ```javascript
|
|
110
|
-
* import { KMSClient, GenerateDataKeyCommand } from "@aws-sdk/client-kms"; // ES Modules import
|
|
111
|
-
* // const { KMSClient, GenerateDataKeyCommand } = require("@aws-sdk/client-kms"); // CommonJS import
|
|
112
|
-
* const client = new KMSClient(config);
|
|
113
|
-
* const command = new GenerateDataKeyCommand(input);
|
|
114
|
-
* const response = await client.send(command);
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* @see {@link GenerateDataKeyCommandInput} for command's `input` shape.
|
|
118
|
-
* @see {@link GenerateDataKeyCommandOutput} for command's `response` shape.
|
|
119
|
-
* @see {@link KMSClientResolvedConfig | config} for command's `input` shape.
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
8
|
class GenerateDataKeyCommand extends smithy_client_1.Command {
|
|
123
|
-
// Start section: command_properties
|
|
124
|
-
// End section: command_properties
|
|
125
9
|
constructor(input) {
|
|
126
|
-
// Start section: command_constructor
|
|
127
10
|
super();
|
|
128
11
|
this.input = input;
|
|
129
|
-
// End section: command_constructor
|
|
130
12
|
}
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
*/
|
|
134
13
|
resolveMiddleware(clientStack, configuration, options) {
|
|
135
14
|
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
136
15
|
const stack = clientStack.concat(this.middlewareStack);
|
|
@@ -5,111 +5,11 @@ const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const models_0_1 = require("../models/models_0");
|
|
7
7
|
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
-
/**
|
|
9
|
-
* <p>Generates a unique asymmetric data key pair. The <code>GenerateDataKeyPair</code>
|
|
10
|
-
* operation returns a plaintext public key, a plaintext private key, and a copy of the private
|
|
11
|
-
* key that is encrypted under the symmetric KMS key you specify. You can use the data key pair
|
|
12
|
-
* to perform asymmetric cryptography and implement digital signatures outside of KMS.</p>
|
|
13
|
-
*
|
|
14
|
-
* <p>You can use the public key that <code>GenerateDataKeyPair</code> returns to encrypt data
|
|
15
|
-
* or verify a signature outside of KMS. Then, store the encrypted private key with the data.
|
|
16
|
-
* When you are ready to decrypt data or sign a message, you can use the <a>Decrypt</a> operation to decrypt the encrypted private key.</p>
|
|
17
|
-
*
|
|
18
|
-
* <p>To generate a data key pair, you must specify a symmetric KMS key to encrypt the private
|
|
19
|
-
* key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key
|
|
20
|
-
* store. To get the type and origin of your KMS key, use the <a>DescribeKey</a>
|
|
21
|
-
* operation. </p>
|
|
22
|
-
* <p>Use the <code>KeyPairSpec</code> parameter to choose an RSA or Elliptic Curve (ECC) data
|
|
23
|
-
* key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for
|
|
24
|
-
* either encryption or signing, but not both. However, KMS cannot enforce any restrictions on
|
|
25
|
-
* the use of data key pairs outside of KMS.</p>
|
|
26
|
-
*
|
|
27
|
-
* <p>If you are using the data key pair to encrypt data, or for any operation where you don't
|
|
28
|
-
* immediately need a private key, consider using the <a>GenerateDataKeyPairWithoutPlaintext</a> operation.
|
|
29
|
-
* <code>GenerateDataKeyPairWithoutPlaintext</code> returns a plaintext public key and an
|
|
30
|
-
* encrypted private key, but omits the plaintext private key that you need only to decrypt
|
|
31
|
-
* ciphertext or sign a message. Later, when you need to decrypt the data or sign a message, use
|
|
32
|
-
* the <a>Decrypt</a> operation to decrypt the encrypted private key in the data key
|
|
33
|
-
* pair.</p>
|
|
34
|
-
*
|
|
35
|
-
* <p>
|
|
36
|
-
* <code>GenerateDataKeyPair</code> returns a unique data key pair for each request. The
|
|
37
|
-
* bytes in the keys are not related to the caller or the KMS key that is used to encrypt the
|
|
38
|
-
* private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in
|
|
39
|
-
* <a href="https://tools.ietf.org/html/rfc5280">RFC 5280</a>. The private key is a
|
|
40
|
-
* DER-encoded PKCS8 PrivateKeyInfo, as specified in <a href="https://tools.ietf.org/html/rfc5958">RFC 5958</a>.</p>
|
|
41
|
-
*
|
|
42
|
-
* <p>You can use the optional encryption context to add additional security to the encryption
|
|
43
|
-
* operation. If you specify an <code>EncryptionContext</code>, you must specify the same
|
|
44
|
-
* encryption context (a case-sensitive exact match) when decrypting the encrypted data key.
|
|
45
|
-
* Otherwise, the request to decrypt fails with an <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption Context</a> in the
|
|
46
|
-
* <i>Key Management Service Developer Guide</i>.</p>
|
|
47
|
-
* <p>The KMS key that you use for this operation must be in a compatible key state. For
|
|
48
|
-
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
49
|
-
* <p>
|
|
50
|
-
* <b>Cross-account
|
|
51
|
-
* use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify
|
|
52
|
-
* the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
|
|
53
|
-
*
|
|
54
|
-
* <p>
|
|
55
|
-
* <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:GenerateDataKeyPair</a> (key policy)</p>
|
|
56
|
-
* <p>
|
|
57
|
-
* <b>Related operations:</b>
|
|
58
|
-
* </p>
|
|
59
|
-
* <ul>
|
|
60
|
-
* <li>
|
|
61
|
-
* <p>
|
|
62
|
-
* <a>Decrypt</a>
|
|
63
|
-
* </p>
|
|
64
|
-
* </li>
|
|
65
|
-
* <li>
|
|
66
|
-
* <p>
|
|
67
|
-
* <a>Encrypt</a>
|
|
68
|
-
* </p>
|
|
69
|
-
* </li>
|
|
70
|
-
* <li>
|
|
71
|
-
* <p>
|
|
72
|
-
* <a>GenerateDataKey</a>
|
|
73
|
-
* </p>
|
|
74
|
-
* </li>
|
|
75
|
-
* <li>
|
|
76
|
-
* <p>
|
|
77
|
-
* <a>GenerateDataKeyPairWithoutPlaintext</a>
|
|
78
|
-
* </p>
|
|
79
|
-
* </li>
|
|
80
|
-
* <li>
|
|
81
|
-
* <p>
|
|
82
|
-
* <a>GenerateDataKeyWithoutPlaintext</a>
|
|
83
|
-
* </p>
|
|
84
|
-
* </li>
|
|
85
|
-
* </ul>
|
|
86
|
-
* @example
|
|
87
|
-
* Use a bare-bones client and the command you need to make an API call.
|
|
88
|
-
* ```javascript
|
|
89
|
-
* import { KMSClient, GenerateDataKeyPairCommand } from "@aws-sdk/client-kms"; // ES Modules import
|
|
90
|
-
* // const { KMSClient, GenerateDataKeyPairCommand } = require("@aws-sdk/client-kms"); // CommonJS import
|
|
91
|
-
* const client = new KMSClient(config);
|
|
92
|
-
* const command = new GenerateDataKeyPairCommand(input);
|
|
93
|
-
* const response = await client.send(command);
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @see {@link GenerateDataKeyPairCommandInput} for command's `input` shape.
|
|
97
|
-
* @see {@link GenerateDataKeyPairCommandOutput} for command's `response` shape.
|
|
98
|
-
* @see {@link KMSClientResolvedConfig | config} for command's `input` shape.
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
8
|
class GenerateDataKeyPairCommand extends smithy_client_1.Command {
|
|
102
|
-
// Start section: command_properties
|
|
103
|
-
// End section: command_properties
|
|
104
9
|
constructor(input) {
|
|
105
|
-
// Start section: command_constructor
|
|
106
10
|
super();
|
|
107
11
|
this.input = input;
|
|
108
|
-
// End section: command_constructor
|
|
109
12
|
}
|
|
110
|
-
/**
|
|
111
|
-
* @internal
|
|
112
|
-
*/
|
|
113
13
|
resolveMiddleware(clientStack, configuration, options) {
|
|
114
14
|
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
115
15
|
const stack = clientStack.concat(this.middlewareStack);
|
|
@@ -5,101 +5,11 @@ const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const models_0_1 = require("../models/models_0");
|
|
7
7
|
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
-
/**
|
|
9
|
-
* <p>Generates a unique asymmetric data key pair. The
|
|
10
|
-
* <code>GenerateDataKeyPairWithoutPlaintext</code> operation returns a plaintext public key
|
|
11
|
-
* and a copy of the private key that is encrypted under the symmetric KMS key you specify.
|
|
12
|
-
* Unlike <a>GenerateDataKeyPair</a>, this operation does not return a plaintext
|
|
13
|
-
* private key. </p>
|
|
14
|
-
* <p>You can use the public key that <code>GenerateDataKeyPairWithoutPlaintext</code> returns
|
|
15
|
-
* to encrypt data or verify a signature outside of KMS. Then, store the encrypted private key
|
|
16
|
-
* with the data. When you are ready to decrypt data or sign a message, you can use the <a>Decrypt</a> operation to decrypt the encrypted private key.</p>
|
|
17
|
-
* <p>To generate a data key pair, you must specify a symmetric KMS key to encrypt the private
|
|
18
|
-
* key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key
|
|
19
|
-
* store. To get the type and origin of your KMS key, use the <a>DescribeKey</a>
|
|
20
|
-
* operation. </p>
|
|
21
|
-
* <p>Use the <code>KeyPairSpec</code> parameter to choose an RSA or Elliptic Curve (ECC) data
|
|
22
|
-
* key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for
|
|
23
|
-
* either encryption or signing, but not both. However, KMS cannot enforce any restrictions on
|
|
24
|
-
* the use of data key pairs outside of KMS.</p>
|
|
25
|
-
* <p>
|
|
26
|
-
* <code>GenerateDataKeyPairWithoutPlaintext</code> returns a unique data key pair for each
|
|
27
|
-
* request. The bytes in the key are not related to the caller or KMS key that is used to encrypt
|
|
28
|
-
* the private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in
|
|
29
|
-
* <a href="https://tools.ietf.org/html/rfc5280">RFC 5280</a>.</p>
|
|
30
|
-
*
|
|
31
|
-
* <p>You can use the optional encryption context to add additional security to the encryption
|
|
32
|
-
* operation. If you specify an <code>EncryptionContext</code>, you must specify the same
|
|
33
|
-
* encryption context (a case-sensitive exact match) when decrypting the encrypted data key.
|
|
34
|
-
* Otherwise, the request to decrypt fails with an <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption Context</a> in the
|
|
35
|
-
* <i>Key Management Service Developer Guide</i>.</p>
|
|
36
|
-
* <p>The KMS key that you use for this operation must be in a compatible key state. For
|
|
37
|
-
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
38
|
-
* <p>
|
|
39
|
-
* <b>Cross-account
|
|
40
|
-
* use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify
|
|
41
|
-
* the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
|
|
42
|
-
*
|
|
43
|
-
* <p>
|
|
44
|
-
* <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:GenerateDataKeyPairWithoutPlaintext</a> (key
|
|
45
|
-
* policy)</p>
|
|
46
|
-
* <p>
|
|
47
|
-
* <b>Related operations:</b>
|
|
48
|
-
* </p>
|
|
49
|
-
* <ul>
|
|
50
|
-
* <li>
|
|
51
|
-
* <p>
|
|
52
|
-
* <a>Decrypt</a>
|
|
53
|
-
* </p>
|
|
54
|
-
* </li>
|
|
55
|
-
* <li>
|
|
56
|
-
* <p>
|
|
57
|
-
* <a>Encrypt</a>
|
|
58
|
-
* </p>
|
|
59
|
-
* </li>
|
|
60
|
-
* <li>
|
|
61
|
-
* <p>
|
|
62
|
-
* <a>GenerateDataKey</a>
|
|
63
|
-
* </p>
|
|
64
|
-
* </li>
|
|
65
|
-
* <li>
|
|
66
|
-
* <p>
|
|
67
|
-
* <a>GenerateDataKeyPair</a>
|
|
68
|
-
* </p>
|
|
69
|
-
* </li>
|
|
70
|
-
* <li>
|
|
71
|
-
* <p>
|
|
72
|
-
* <a>GenerateDataKeyWithoutPlaintext</a>
|
|
73
|
-
* </p>
|
|
74
|
-
* </li>
|
|
75
|
-
* </ul>
|
|
76
|
-
* @example
|
|
77
|
-
* Use a bare-bones client and the command you need to make an API call.
|
|
78
|
-
* ```javascript
|
|
79
|
-
* import { KMSClient, GenerateDataKeyPairWithoutPlaintextCommand } from "@aws-sdk/client-kms"; // ES Modules import
|
|
80
|
-
* // const { KMSClient, GenerateDataKeyPairWithoutPlaintextCommand } = require("@aws-sdk/client-kms"); // CommonJS import
|
|
81
|
-
* const client = new KMSClient(config);
|
|
82
|
-
* const command = new GenerateDataKeyPairWithoutPlaintextCommand(input);
|
|
83
|
-
* const response = await client.send(command);
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @see {@link GenerateDataKeyPairWithoutPlaintextCommandInput} for command's `input` shape.
|
|
87
|
-
* @see {@link GenerateDataKeyPairWithoutPlaintextCommandOutput} for command's `response` shape.
|
|
88
|
-
* @see {@link KMSClientResolvedConfig | config} for command's `input` shape.
|
|
89
|
-
*
|
|
90
|
-
*/
|
|
91
8
|
class GenerateDataKeyPairWithoutPlaintextCommand extends smithy_client_1.Command {
|
|
92
|
-
// Start section: command_properties
|
|
93
|
-
// End section: command_properties
|
|
94
9
|
constructor(input) {
|
|
95
|
-
// Start section: command_constructor
|
|
96
10
|
super();
|
|
97
11
|
this.input = input;
|
|
98
|
-
// End section: command_constructor
|
|
99
12
|
}
|
|
100
|
-
/**
|
|
101
|
-
* @internal
|
|
102
|
-
*/
|
|
103
13
|
resolveMiddleware(clientStack, configuration, options) {
|
|
104
14
|
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
105
15
|
const stack = clientStack.concat(this.middlewareStack);
|
|
@@ -5,106 +5,11 @@ const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const models_0_1 = require("../models/models_0");
|
|
7
7
|
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
-
/**
|
|
9
|
-
* <p>Generates a unique symmetric data key. This operation returns a data key that is encrypted
|
|
10
|
-
* under a KMS key that you specify. To request an asymmetric data key pair, use the <a>GenerateDataKeyPair</a> or <a>GenerateDataKeyPairWithoutPlaintext</a>
|
|
11
|
-
* operations.</p>
|
|
12
|
-
* <p>
|
|
13
|
-
* <code>GenerateDataKeyWithoutPlaintext</code> is identical to the <a>GenerateDataKey</a> operation except that returns only the encrypted copy of the
|
|
14
|
-
* data key. This operation is useful for systems that need to encrypt data at some point, but
|
|
15
|
-
* not immediately. When you need to encrypt the data, you call the <a>Decrypt</a>
|
|
16
|
-
* operation on the encrypted copy of the key. </p>
|
|
17
|
-
* <p>It's also useful in distributed systems with different levels of trust. For example, you
|
|
18
|
-
* might store encrypted data in containers. One component of your system creates new containers
|
|
19
|
-
* and stores an encrypted data key with each container. Then, a different component puts the
|
|
20
|
-
* data into the containers. That component first decrypts the data key, uses the plaintext data
|
|
21
|
-
* key to encrypt data, puts the encrypted data into the container, and then destroys the
|
|
22
|
-
* plaintext data key. In this system, the component that creates the containers never sees the
|
|
23
|
-
* plaintext data key.</p>
|
|
24
|
-
* <p>
|
|
25
|
-
* <code>GenerateDataKeyWithoutPlaintext</code> returns a unique data key for each request.
|
|
26
|
-
* The bytes in the keys are not related to the caller or KMS key that is used to encrypt the
|
|
27
|
-
* private key.</p>
|
|
28
|
-
*
|
|
29
|
-
* <p>To generate a data key, you must specify the symmetric KMS key that is used to encrypt the
|
|
30
|
-
* data key. You cannot use an asymmetric KMS key to generate a data key. To get the type of your
|
|
31
|
-
* KMS key, use the <a>DescribeKey</a> operation.</p>
|
|
32
|
-
*
|
|
33
|
-
* <p>If the operation succeeds, you will find the encrypted copy of the data key in the
|
|
34
|
-
* <code>CiphertextBlob</code> field.</p>
|
|
35
|
-
*
|
|
36
|
-
* <p>You can use the optional encryption context to add additional security to the encryption
|
|
37
|
-
* operation. If you specify an <code>EncryptionContext</code>, you must specify the same
|
|
38
|
-
* encryption context (a case-sensitive exact match) when decrypting the encrypted data key.
|
|
39
|
-
* Otherwise, the request to decrypt fails with an <code>InvalidCiphertextException</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context">Encryption Context</a> in the
|
|
40
|
-
* <i>Key Management Service Developer Guide</i>.</p>
|
|
41
|
-
* <p>The KMS key that you use for this operation must be in a compatible key state. For
|
|
42
|
-
* details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a> in the <i>Key Management Service Developer Guide</i>.</p>
|
|
43
|
-
* <p>
|
|
44
|
-
* <b>Cross-account
|
|
45
|
-
* use</b>: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify
|
|
46
|
-
* the key ARN or alias ARN in the value of the <code>KeyId</code> parameter.</p>
|
|
47
|
-
*
|
|
48
|
-
* <p>
|
|
49
|
-
* <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:GenerateDataKeyWithoutPlaintext</a> (key
|
|
50
|
-
* policy)</p>
|
|
51
|
-
* <p>
|
|
52
|
-
* <b>Related operations:</b>
|
|
53
|
-
* </p>
|
|
54
|
-
* <ul>
|
|
55
|
-
* <li>
|
|
56
|
-
* <p>
|
|
57
|
-
* <a>Decrypt</a>
|
|
58
|
-
* </p>
|
|
59
|
-
* </li>
|
|
60
|
-
* <li>
|
|
61
|
-
* <p>
|
|
62
|
-
* <a>Encrypt</a>
|
|
63
|
-
* </p>
|
|
64
|
-
* </li>
|
|
65
|
-
* <li>
|
|
66
|
-
* <p>
|
|
67
|
-
* <a>GenerateDataKey</a>
|
|
68
|
-
* </p>
|
|
69
|
-
* </li>
|
|
70
|
-
* <li>
|
|
71
|
-
* <p>
|
|
72
|
-
* <a>GenerateDataKeyPair</a>
|
|
73
|
-
* </p>
|
|
74
|
-
* </li>
|
|
75
|
-
* <li>
|
|
76
|
-
* <p>
|
|
77
|
-
* <a>GenerateDataKeyPairWithoutPlaintext</a>
|
|
78
|
-
* </p>
|
|
79
|
-
* </li>
|
|
80
|
-
* </ul>
|
|
81
|
-
* @example
|
|
82
|
-
* Use a bare-bones client and the command you need to make an API call.
|
|
83
|
-
* ```javascript
|
|
84
|
-
* import { KMSClient, GenerateDataKeyWithoutPlaintextCommand } from "@aws-sdk/client-kms"; // ES Modules import
|
|
85
|
-
* // const { KMSClient, GenerateDataKeyWithoutPlaintextCommand } = require("@aws-sdk/client-kms"); // CommonJS import
|
|
86
|
-
* const client = new KMSClient(config);
|
|
87
|
-
* const command = new GenerateDataKeyWithoutPlaintextCommand(input);
|
|
88
|
-
* const response = await client.send(command);
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @see {@link GenerateDataKeyWithoutPlaintextCommandInput} for command's `input` shape.
|
|
92
|
-
* @see {@link GenerateDataKeyWithoutPlaintextCommandOutput} for command's `response` shape.
|
|
93
|
-
* @see {@link KMSClientResolvedConfig | config} for command's `input` shape.
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
8
|
class GenerateDataKeyWithoutPlaintextCommand extends smithy_client_1.Command {
|
|
97
|
-
// Start section: command_properties
|
|
98
|
-
// End section: command_properties
|
|
99
9
|
constructor(input) {
|
|
100
|
-
// Start section: command_constructor
|
|
101
10
|
super();
|
|
102
11
|
this.input = input;
|
|
103
|
-
// End section: command_constructor
|
|
104
12
|
}
|
|
105
|
-
/**
|
|
106
|
-
* @internal
|
|
107
|
-
*/
|
|
108
13
|
resolveMiddleware(clientStack, configuration, options) {
|
|
109
14
|
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
110
15
|
const stack = clientStack.concat(this.middlewareStack);
|