aws_sdk_kms/operation/create_key/_create_key_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateKeyInput {
6 /// <p>The key policy to attach to the KMS key.</p>
7 /// <p>If you provide a key policy, it must meet the following criteria:</p>
8 /// <ul>
9 /// <li>
10 /// <p>The key policy must allow the calling principal to make a subsequent <code>PutKeyPolicy</code> request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>. (To omit this condition, set <code>BypassPolicyLockoutSafetyCheck</code> to true.)</p></li>
11 /// <li>
12 /// <p>Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency">Changes that I make are not always immediately visible</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p></li>
13 /// </ul><note>
14 /// <p>If either of the required <code>Resource</code> or <code>Action</code> elements are missing from a key policy statement, the policy statement has no effect. When a key policy statement is missing one of these elements, the KMS console correctly reports an error, but the <code>CreateKey</code> and <code>PutKeyPolicy</code> API requests succeed, even though the policy statement is ineffective.</p>
15 /// <p>For more information on required key policy elements, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html#key-policy-elements">Elements in a key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
16 /// </note>
17 /// <p>If you do not provide a key policy, KMS attaches a default key policy to the KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p><note>
18 /// <p>If the key policy exceeds the length constraint, KMS returns a <code>LimitExceededException</code>.</p>
19 /// </note>
20 /// <p>For help writing and formatting a JSON policy document, see the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html">IAM JSON Policy Reference</a> in the <i> <i>Identity and Access Management User Guide</i> </i>.</p>
21 pub policy: ::std::option::Option<::std::string::String>,
22 /// <p>A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description).</p><important>
23 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
24 /// </important>
25 /// <p>To set or change the description after the key is created, use <code>UpdateKeyDescription</code>.</p>
26 pub description: ::std::option::Option<::std::string::String>,
27 /// <p>Determines the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a> for which you can use the KMS key. The default value is <code>ENCRYPT_DECRYPT</code>. This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#key-usage"> <code>KeyUsage</code> </a> value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to <a href="https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final">NIST SP 800-57 Recommendations for Key Management</a>, section 5.2, Key usage.</p>
28 /// <p>Select only one valid value.</p>
29 /// <ul>
30 /// <li>
31 /// <p>For symmetric encryption KMS keys, omit the parameter or specify <code>ENCRYPT_DECRYPT</code>.</p></li>
32 /// <li>
33 /// <p>For HMAC KMS keys (symmetric), specify <code>GENERATE_VERIFY_MAC</code>.</p></li>
34 /// <li>
35 /// <p>For asymmetric KMS keys with RSA key pairs, specify <code>ENCRYPT_DECRYPT</code> or <code>SIGN_VERIFY</code>.</p></li>
36 /// <li>
37 /// <p>For asymmetric KMS keys with NIST-standard elliptic curve key pairs, specify <code>SIGN_VERIFY</code> or <code>KEY_AGREEMENT</code>.</p></li>
38 /// <li>
39 /// <p>For asymmetric KMS keys with <code>ECC_SECG_P256K1</code> key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
40 /// <li>
41 /// <p>For asymmetric KMS keys with ML-DSA key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
42 /// <li>
43 /// <p>For asymmetric KMS keys with ML-KEM key pairs, specify <code>ENCAPSULATE_DECAPSULATE</code>.</p></li>
44 /// <li>
45 /// <p>For asymmetric KMS keys with SM2 key pairs (China Regions only), specify <code>ENCRYPT_DECRYPT</code>, <code>SIGN_VERIFY</code>, or <code>KEY_AGREEMENT</code>.</p></li>
46 /// </ul>
47 pub key_usage: ::std::option::Option<crate::types::KeyUsageType>,
48 /// <p>Instead, use the <code>KeySpec</code> parameter.</p>
49 /// <p>The <code>KeySpec</code> and <code>CustomerMasterKeySpec</code> parameters work the same way. Only the names differ. We recommend that you use <code>KeySpec</code> parameter in your code. However, to avoid breaking changes, KMS supports both parameters.</p>
50 #[deprecated(note = "This parameter has been deprecated. Instead, use the KeySpec parameter.")]
51 pub customer_master_key_spec: ::std::option::Option<crate::types::CustomerMasterKeySpec>,
52 /// <p>Specifies the type of KMS key to create. The default value, <code>SYMMETRIC_DEFAULT</code>, creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose-key-spec.html">Key spec reference</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
53 /// <p>The <code>KeySpec</code> determines whether the KMS key contains a symmetric key or an asymmetric key pair. It also determines the algorithms that the KMS key supports. You can't change the <code>KeySpec</code> after the KMS key is created. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-encryption-algorithm">kms:EncryptionAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-mac-algorithm">kms:MacAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-key-agreement-algorithm">kms:KeyAgreementAlgorithm</a>, or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-signing-algorithm">kms:SigningAlgorithm</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p><important>
54 /// <p><a href="http://aws.amazon.com/kms/features/#AWS_Service_Integration">Amazon Web Services services that are integrated with KMS</a> use symmetric encryption KMS keys to protect your data. These services do not support asymmetric KMS keys or HMAC KMS keys.</p>
55 /// </important>
56 /// <p>KMS supports the following key specs for KMS keys:</p>
57 /// <ul>
58 /// <li>
59 /// <p>Symmetric encryption key (default)</p>
60 /// <ul>
61 /// <li>
62 /// <p><code>SYMMETRIC_DEFAULT</code></p></li>
63 /// </ul></li>
64 /// <li>
65 /// <p>HMAC keys (symmetric)</p>
66 /// <ul>
67 /// <li>
68 /// <p><code>HMAC_224</code></p></li>
69 /// <li>
70 /// <p><code>HMAC_256</code></p></li>
71 /// <li>
72 /// <p><code>HMAC_384</code></p></li>
73 /// <li>
74 /// <p><code>HMAC_512</code></p></li>
75 /// </ul></li>
76 /// <li>
77 /// <p>Asymmetric RSA key pairs (encryption and decryption -or- signing and verification)</p>
78 /// <ul>
79 /// <li>
80 /// <p><code>RSA_2048</code></p></li>
81 /// <li>
82 /// <p><code>RSA_3072</code></p></li>
83 /// <li>
84 /// <p><code>RSA_4096</code></p></li>
85 /// </ul></li>
86 /// <li>
87 /// <p>Asymmetric NIST-standard elliptic curve key pairs (signing and verification -or- deriving shared secrets)</p>
88 /// <ul>
89 /// <li>
90 /// <p><code>ECC_NIST_P256</code> (secp256r1)</p></li>
91 /// <li>
92 /// <p><code>ECC_NIST_P384</code> (secp384r1)</p></li>
93 /// <li>
94 /// <p><code>ECC_NIST_P521</code> (secp521r1)</p></li>
95 /// <li>
96 /// <p><code>ECC_NIST_EDWARDS25519</code> (ed25519) - signing and verification only</p>
97 /// <ul>
98 /// <li>
99 /// <p><b>Note:</b> For ECC_NIST_EDWARDS25519 KMS keys, the ED25519_SHA_512 signing algorithm requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:RAW</code> </a>, while ED25519_PH_SHA_512 requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:DIGEST</code> </a>. These message types cannot be used interchangeably.</p></li>
100 /// </ul></li>
101 /// </ul></li>
102 /// <li>
103 /// <p>Other asymmetric elliptic curve key pairs (signing and verification)</p>
104 /// <ul>
105 /// <li>
106 /// <p><code>ECC_SECG_P256K1</code> (secp256k1), commonly used for cryptocurrencies.</p></li>
107 /// </ul></li>
108 /// <li>
109 /// <p>Asymmetric ML-DSA key pairs (signing and verification)</p>
110 /// <ul>
111 /// <li>
112 /// <p><code>ML_DSA_44</code></p></li>
113 /// <li>
114 /// <p><code>ML_DSA_65</code></p></li>
115 /// <li>
116 /// <p><code>ML_DSA_87</code></p></li>
117 /// </ul></li>
118 /// <li>
119 /// <p>Asymmetric ML-KEM key pairs (establishing shared secrets)</p>
120 /// <ul>
121 /// <li>
122 /// <p><code>ML_KEM_512</code></p></li>
123 /// <li>
124 /// <p><code>ML_KEM_768</code></p></li>
125 /// <li>
126 /// <p><code>ML_KEM_1024</code></p></li>
127 /// </ul>
128 /// <p>The ML-KEM key specs are not available in China Regions.</p></li>
129 /// <li>
130 /// <p>SM2 key pairs (encryption and decryption -or- signing and verification -or- deriving shared secrets)</p>
131 /// <ul>
132 /// <li>
133 /// <p><code>SM2</code> (China Regions only)</p></li>
134 /// </ul></li>
135 /// </ul>
136 pub key_spec: ::std::option::Option<crate::types::KeySpec>,
137 /// <p>The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is <code>AWS_KMS</code>, which means that KMS creates the key material.</p>
138 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html">create a KMS key with no key material</a> (for imported key material), set this value to <code>EXTERNAL</code>. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>. The <code>EXTERNAL</code> origin value is valid only for symmetric KMS keys.</p>
139 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html">create a KMS key in an CloudHSM key store</a> and create its key material in the associated CloudHSM cluster, set this value to <code>AWS_CLOUDHSM</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the CloudHSM key store. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
140 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html">create a KMS key in an external key store</a>, set this value to <code>EXTERNAL_KEY_STORE</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the external key store and the <code>XksKeyId</code> parameter to identify the associated external key. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
141 pub origin: ::std::option::Option<crate::types::OriginType>,
142 /// <p>Creates the KMS key in the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key store</a>. The <code>ConnectionState</code> of the custom key store must be <code>CONNECTED</code>. To find the CustomKeyStoreID and ConnectionState use the <code>DescribeCustomKeyStores</code> operation.</p>
143 /// <p>This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store.</p>
144 /// <p>When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable 256-bit symmetric key in its associated CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you must use the <code>XksKeyId</code> parameter to specify an external key that serves as key material for the KMS key.</p>
145 pub custom_key_store_id: ::std::option::Option<::std::string::String>,
146 /// <p>Skips ("bypasses") the key policy lockout safety check. The default value is false.</p><important>
147 /// <p>Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.</p>
148 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
149 /// </important>
150 /// <p>Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a> request on the KMS key.</p>
151 pub bypass_policy_lockout_safety_check: ::std::option::Option<bool>,
152 /// <p>Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the <code>TagResource</code> operation.</p><important>
153 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
154 /// </important> <note>
155 /// <p>Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
156 /// </note>
157 /// <p>To use this parameter, you must have <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:TagResource</a> permission in an IAM policy.</p>
158 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, KMS replaces the current tag value with the specified one.</p>
159 /// <p>When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html">Tags in KMS</a>.</p>
160 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
161 /// <p>Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key.</p>
162 /// <p>For a multi-Region key, set this parameter to <code>True</code>. For a single-Region KMS key, omit this parameter or set it to <code>False</code>. The default value is <code>False</code>.</p>
163 /// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
164 /// <p>This value creates a <i>primary key</i>, not a replica. To create a <i>replica key</i>, use the <code>ReplicateKey</code> operation.</p>
165 /// <p>You can create a symmetric or asymmetric multi-Region key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store.</p>
166 pub multi_region: ::std::option::Option<bool>,
167 /// <p>Identifies the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key">external key</a> that serves as key material for the KMS key in an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key store</a>. Specify the ID that the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy">external key store proxy</a> uses to refer to the external key. For help, see the documentation for your external key store proxy.</p>
168 /// <p>This parameter is required for a KMS key with an <code>Origin</code> value of <code>EXTERNAL_KEY_STORE</code>. It is not valid for KMS keys with any other <code>Origin</code> value.</p>
169 /// <p>The external key must be an existing 256-bit AES symmetric encryption key hosted outside of Amazon Web Services in an external key manager associated with the external key store specified by the <code>CustomKeyStoreId</code> parameter. This key must be enabled and configured to perform encryption and decryption. Each KMS key in an external key store must use a different external key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html#xks-key-requirements">Requirements for a KMS key in an external key store</a> in the <i>Key Management Service Developer Guide</i>.</p>
170 /// <p>Each KMS key in an external key store is associated two backing keys. One is key material that KMS generates. The other is the external key specified by this parameter. When you use the KMS key in an external key store to encrypt data, the encryption operation is performed first by KMS using the KMS key material, and then by the external key manager using the specified external key, a process known as <i>double encryption</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption">Double encryption</a> in the <i>Key Management Service Developer Guide</i>.</p>
171 pub xks_key_id: ::std::option::Option<::std::string::String>,
172}
173impl CreateKeyInput {
174 /// <p>The key policy to attach to the KMS key.</p>
175 /// <p>If you provide a key policy, it must meet the following criteria:</p>
176 /// <ul>
177 /// <li>
178 /// <p>The key policy must allow the calling principal to make a subsequent <code>PutKeyPolicy</code> request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>. (To omit this condition, set <code>BypassPolicyLockoutSafetyCheck</code> to true.)</p></li>
179 /// <li>
180 /// <p>Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency">Changes that I make are not always immediately visible</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p></li>
181 /// </ul><note>
182 /// <p>If either of the required <code>Resource</code> or <code>Action</code> elements are missing from a key policy statement, the policy statement has no effect. When a key policy statement is missing one of these elements, the KMS console correctly reports an error, but the <code>CreateKey</code> and <code>PutKeyPolicy</code> API requests succeed, even though the policy statement is ineffective.</p>
183 /// <p>For more information on required key policy elements, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html#key-policy-elements">Elements in a key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
184 /// </note>
185 /// <p>If you do not provide a key policy, KMS attaches a default key policy to the KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p><note>
186 /// <p>If the key policy exceeds the length constraint, KMS returns a <code>LimitExceededException</code>.</p>
187 /// </note>
188 /// <p>For help writing and formatting a JSON policy document, see the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html">IAM JSON Policy Reference</a> in the <i> <i>Identity and Access Management User Guide</i> </i>.</p>
189 pub fn policy(&self) -> ::std::option::Option<&str> {
190 self.policy.as_deref()
191 }
192 /// <p>A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description).</p><important>
193 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
194 /// </important>
195 /// <p>To set or change the description after the key is created, use <code>UpdateKeyDescription</code>.</p>
196 pub fn description(&self) -> ::std::option::Option<&str> {
197 self.description.as_deref()
198 }
199 /// <p>Determines the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a> for which you can use the KMS key. The default value is <code>ENCRYPT_DECRYPT</code>. This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#key-usage"> <code>KeyUsage</code> </a> value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to <a href="https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final">NIST SP 800-57 Recommendations for Key Management</a>, section 5.2, Key usage.</p>
200 /// <p>Select only one valid value.</p>
201 /// <ul>
202 /// <li>
203 /// <p>For symmetric encryption KMS keys, omit the parameter or specify <code>ENCRYPT_DECRYPT</code>.</p></li>
204 /// <li>
205 /// <p>For HMAC KMS keys (symmetric), specify <code>GENERATE_VERIFY_MAC</code>.</p></li>
206 /// <li>
207 /// <p>For asymmetric KMS keys with RSA key pairs, specify <code>ENCRYPT_DECRYPT</code> or <code>SIGN_VERIFY</code>.</p></li>
208 /// <li>
209 /// <p>For asymmetric KMS keys with NIST-standard elliptic curve key pairs, specify <code>SIGN_VERIFY</code> or <code>KEY_AGREEMENT</code>.</p></li>
210 /// <li>
211 /// <p>For asymmetric KMS keys with <code>ECC_SECG_P256K1</code> key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
212 /// <li>
213 /// <p>For asymmetric KMS keys with ML-DSA key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
214 /// <li>
215 /// <p>For asymmetric KMS keys with ML-KEM key pairs, specify <code>ENCAPSULATE_DECAPSULATE</code>.</p></li>
216 /// <li>
217 /// <p>For asymmetric KMS keys with SM2 key pairs (China Regions only), specify <code>ENCRYPT_DECRYPT</code>, <code>SIGN_VERIFY</code>, or <code>KEY_AGREEMENT</code>.</p></li>
218 /// </ul>
219 pub fn key_usage(&self) -> ::std::option::Option<&crate::types::KeyUsageType> {
220 self.key_usage.as_ref()
221 }
222 /// <p>Instead, use the <code>KeySpec</code> parameter.</p>
223 /// <p>The <code>KeySpec</code> and <code>CustomerMasterKeySpec</code> parameters work the same way. Only the names differ. We recommend that you use <code>KeySpec</code> parameter in your code. However, to avoid breaking changes, KMS supports both parameters.</p>
224 #[deprecated(note = "This parameter has been deprecated. Instead, use the KeySpec parameter.")]
225 pub fn customer_master_key_spec(&self) -> ::std::option::Option<&crate::types::CustomerMasterKeySpec> {
226 self.customer_master_key_spec.as_ref()
227 }
228 /// <p>Specifies the type of KMS key to create. The default value, <code>SYMMETRIC_DEFAULT</code>, creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose-key-spec.html">Key spec reference</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
229 /// <p>The <code>KeySpec</code> determines whether the KMS key contains a symmetric key or an asymmetric key pair. It also determines the algorithms that the KMS key supports. You can't change the <code>KeySpec</code> after the KMS key is created. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-encryption-algorithm">kms:EncryptionAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-mac-algorithm">kms:MacAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-key-agreement-algorithm">kms:KeyAgreementAlgorithm</a>, or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-signing-algorithm">kms:SigningAlgorithm</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p><important>
230 /// <p><a href="http://aws.amazon.com/kms/features/#AWS_Service_Integration">Amazon Web Services services that are integrated with KMS</a> use symmetric encryption KMS keys to protect your data. These services do not support asymmetric KMS keys or HMAC KMS keys.</p>
231 /// </important>
232 /// <p>KMS supports the following key specs for KMS keys:</p>
233 /// <ul>
234 /// <li>
235 /// <p>Symmetric encryption key (default)</p>
236 /// <ul>
237 /// <li>
238 /// <p><code>SYMMETRIC_DEFAULT</code></p></li>
239 /// </ul></li>
240 /// <li>
241 /// <p>HMAC keys (symmetric)</p>
242 /// <ul>
243 /// <li>
244 /// <p><code>HMAC_224</code></p></li>
245 /// <li>
246 /// <p><code>HMAC_256</code></p></li>
247 /// <li>
248 /// <p><code>HMAC_384</code></p></li>
249 /// <li>
250 /// <p><code>HMAC_512</code></p></li>
251 /// </ul></li>
252 /// <li>
253 /// <p>Asymmetric RSA key pairs (encryption and decryption -or- signing and verification)</p>
254 /// <ul>
255 /// <li>
256 /// <p><code>RSA_2048</code></p></li>
257 /// <li>
258 /// <p><code>RSA_3072</code></p></li>
259 /// <li>
260 /// <p><code>RSA_4096</code></p></li>
261 /// </ul></li>
262 /// <li>
263 /// <p>Asymmetric NIST-standard elliptic curve key pairs (signing and verification -or- deriving shared secrets)</p>
264 /// <ul>
265 /// <li>
266 /// <p><code>ECC_NIST_P256</code> (secp256r1)</p></li>
267 /// <li>
268 /// <p><code>ECC_NIST_P384</code> (secp384r1)</p></li>
269 /// <li>
270 /// <p><code>ECC_NIST_P521</code> (secp521r1)</p></li>
271 /// <li>
272 /// <p><code>ECC_NIST_EDWARDS25519</code> (ed25519) - signing and verification only</p>
273 /// <ul>
274 /// <li>
275 /// <p><b>Note:</b> For ECC_NIST_EDWARDS25519 KMS keys, the ED25519_SHA_512 signing algorithm requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:RAW</code> </a>, while ED25519_PH_SHA_512 requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:DIGEST</code> </a>. These message types cannot be used interchangeably.</p></li>
276 /// </ul></li>
277 /// </ul></li>
278 /// <li>
279 /// <p>Other asymmetric elliptic curve key pairs (signing and verification)</p>
280 /// <ul>
281 /// <li>
282 /// <p><code>ECC_SECG_P256K1</code> (secp256k1), commonly used for cryptocurrencies.</p></li>
283 /// </ul></li>
284 /// <li>
285 /// <p>Asymmetric ML-DSA key pairs (signing and verification)</p>
286 /// <ul>
287 /// <li>
288 /// <p><code>ML_DSA_44</code></p></li>
289 /// <li>
290 /// <p><code>ML_DSA_65</code></p></li>
291 /// <li>
292 /// <p><code>ML_DSA_87</code></p></li>
293 /// </ul></li>
294 /// <li>
295 /// <p>Asymmetric ML-KEM key pairs (establishing shared secrets)</p>
296 /// <ul>
297 /// <li>
298 /// <p><code>ML_KEM_512</code></p></li>
299 /// <li>
300 /// <p><code>ML_KEM_768</code></p></li>
301 /// <li>
302 /// <p><code>ML_KEM_1024</code></p></li>
303 /// </ul>
304 /// <p>The ML-KEM key specs are not available in China Regions.</p></li>
305 /// <li>
306 /// <p>SM2 key pairs (encryption and decryption -or- signing and verification -or- deriving shared secrets)</p>
307 /// <ul>
308 /// <li>
309 /// <p><code>SM2</code> (China Regions only)</p></li>
310 /// </ul></li>
311 /// </ul>
312 pub fn key_spec(&self) -> ::std::option::Option<&crate::types::KeySpec> {
313 self.key_spec.as_ref()
314 }
315 /// <p>The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is <code>AWS_KMS</code>, which means that KMS creates the key material.</p>
316 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html">create a KMS key with no key material</a> (for imported key material), set this value to <code>EXTERNAL</code>. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>. The <code>EXTERNAL</code> origin value is valid only for symmetric KMS keys.</p>
317 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html">create a KMS key in an CloudHSM key store</a> and create its key material in the associated CloudHSM cluster, set this value to <code>AWS_CLOUDHSM</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the CloudHSM key store. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
318 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html">create a KMS key in an external key store</a>, set this value to <code>EXTERNAL_KEY_STORE</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the external key store and the <code>XksKeyId</code> parameter to identify the associated external key. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
319 pub fn origin(&self) -> ::std::option::Option<&crate::types::OriginType> {
320 self.origin.as_ref()
321 }
322 /// <p>Creates the KMS key in the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key store</a>. The <code>ConnectionState</code> of the custom key store must be <code>CONNECTED</code>. To find the CustomKeyStoreID and ConnectionState use the <code>DescribeCustomKeyStores</code> operation.</p>
323 /// <p>This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store.</p>
324 /// <p>When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable 256-bit symmetric key in its associated CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you must use the <code>XksKeyId</code> parameter to specify an external key that serves as key material for the KMS key.</p>
325 pub fn custom_key_store_id(&self) -> ::std::option::Option<&str> {
326 self.custom_key_store_id.as_deref()
327 }
328 /// <p>Skips ("bypasses") the key policy lockout safety check. The default value is false.</p><important>
329 /// <p>Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.</p>
330 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
331 /// </important>
332 /// <p>Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a> request on the KMS key.</p>
333 pub fn bypass_policy_lockout_safety_check(&self) -> ::std::option::Option<bool> {
334 self.bypass_policy_lockout_safety_check
335 }
336 /// <p>Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the <code>TagResource</code> operation.</p><important>
337 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
338 /// </important> <note>
339 /// <p>Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
340 /// </note>
341 /// <p>To use this parameter, you must have <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:TagResource</a> permission in an IAM policy.</p>
342 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, KMS replaces the current tag value with the specified one.</p>
343 /// <p>When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html">Tags in KMS</a>.</p>
344 ///
345 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
346 pub fn tags(&self) -> &[crate::types::Tag] {
347 self.tags.as_deref().unwrap_or_default()
348 }
349 /// <p>Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key.</p>
350 /// <p>For a multi-Region key, set this parameter to <code>True</code>. For a single-Region KMS key, omit this parameter or set it to <code>False</code>. The default value is <code>False</code>.</p>
351 /// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
352 /// <p>This value creates a <i>primary key</i>, not a replica. To create a <i>replica key</i>, use the <code>ReplicateKey</code> operation.</p>
353 /// <p>You can create a symmetric or asymmetric multi-Region key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store.</p>
354 pub fn multi_region(&self) -> ::std::option::Option<bool> {
355 self.multi_region
356 }
357 /// <p>Identifies the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key">external key</a> that serves as key material for the KMS key in an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key store</a>. Specify the ID that the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy">external key store proxy</a> uses to refer to the external key. For help, see the documentation for your external key store proxy.</p>
358 /// <p>This parameter is required for a KMS key with an <code>Origin</code> value of <code>EXTERNAL_KEY_STORE</code>. It is not valid for KMS keys with any other <code>Origin</code> value.</p>
359 /// <p>The external key must be an existing 256-bit AES symmetric encryption key hosted outside of Amazon Web Services in an external key manager associated with the external key store specified by the <code>CustomKeyStoreId</code> parameter. This key must be enabled and configured to perform encryption and decryption. Each KMS key in an external key store must use a different external key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html#xks-key-requirements">Requirements for a KMS key in an external key store</a> in the <i>Key Management Service Developer Guide</i>.</p>
360 /// <p>Each KMS key in an external key store is associated two backing keys. One is key material that KMS generates. The other is the external key specified by this parameter. When you use the KMS key in an external key store to encrypt data, the encryption operation is performed first by KMS using the KMS key material, and then by the external key manager using the specified external key, a process known as <i>double encryption</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption">Double encryption</a> in the <i>Key Management Service Developer Guide</i>.</p>
361 pub fn xks_key_id(&self) -> ::std::option::Option<&str> {
362 self.xks_key_id.as_deref()
363 }
364}
365impl CreateKeyInput {
366 /// Creates a new builder-style object to manufacture [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
367 pub fn builder() -> crate::operation::create_key::builders::CreateKeyInputBuilder {
368 crate::operation::create_key::builders::CreateKeyInputBuilder::default()
369 }
370}
371
372/// A builder for [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
373#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
374#[non_exhaustive]
375pub struct CreateKeyInputBuilder {
376 pub(crate) policy: ::std::option::Option<::std::string::String>,
377 pub(crate) description: ::std::option::Option<::std::string::String>,
378 pub(crate) key_usage: ::std::option::Option<crate::types::KeyUsageType>,
379 pub(crate) customer_master_key_spec: ::std::option::Option<crate::types::CustomerMasterKeySpec>,
380 pub(crate) key_spec: ::std::option::Option<crate::types::KeySpec>,
381 pub(crate) origin: ::std::option::Option<crate::types::OriginType>,
382 pub(crate) custom_key_store_id: ::std::option::Option<::std::string::String>,
383 pub(crate) bypass_policy_lockout_safety_check: ::std::option::Option<bool>,
384 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
385 pub(crate) multi_region: ::std::option::Option<bool>,
386 pub(crate) xks_key_id: ::std::option::Option<::std::string::String>,
387}
388impl CreateKeyInputBuilder {
389 /// <p>The key policy to attach to the KMS key.</p>
390 /// <p>If you provide a key policy, it must meet the following criteria:</p>
391 /// <ul>
392 /// <li>
393 /// <p>The key policy must allow the calling principal to make a subsequent <code>PutKeyPolicy</code> request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>. (To omit this condition, set <code>BypassPolicyLockoutSafetyCheck</code> to true.)</p></li>
394 /// <li>
395 /// <p>Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency">Changes that I make are not always immediately visible</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p></li>
396 /// </ul><note>
397 /// <p>If either of the required <code>Resource</code> or <code>Action</code> elements are missing from a key policy statement, the policy statement has no effect. When a key policy statement is missing one of these elements, the KMS console correctly reports an error, but the <code>CreateKey</code> and <code>PutKeyPolicy</code> API requests succeed, even though the policy statement is ineffective.</p>
398 /// <p>For more information on required key policy elements, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html#key-policy-elements">Elements in a key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
399 /// </note>
400 /// <p>If you do not provide a key policy, KMS attaches a default key policy to the KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p><note>
401 /// <p>If the key policy exceeds the length constraint, KMS returns a <code>LimitExceededException</code>.</p>
402 /// </note>
403 /// <p>For help writing and formatting a JSON policy document, see the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html">IAM JSON Policy Reference</a> in the <i> <i>Identity and Access Management User Guide</i> </i>.</p>
404 pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
405 self.policy = ::std::option::Option::Some(input.into());
406 self
407 }
408 /// <p>The key policy to attach to the KMS key.</p>
409 /// <p>If you provide a key policy, it must meet the following criteria:</p>
410 /// <ul>
411 /// <li>
412 /// <p>The key policy must allow the calling principal to make a subsequent <code>PutKeyPolicy</code> request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>. (To omit this condition, set <code>BypassPolicyLockoutSafetyCheck</code> to true.)</p></li>
413 /// <li>
414 /// <p>Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency">Changes that I make are not always immediately visible</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p></li>
415 /// </ul><note>
416 /// <p>If either of the required <code>Resource</code> or <code>Action</code> elements are missing from a key policy statement, the policy statement has no effect. When a key policy statement is missing one of these elements, the KMS console correctly reports an error, but the <code>CreateKey</code> and <code>PutKeyPolicy</code> API requests succeed, even though the policy statement is ineffective.</p>
417 /// <p>For more information on required key policy elements, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html#key-policy-elements">Elements in a key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
418 /// </note>
419 /// <p>If you do not provide a key policy, KMS attaches a default key policy to the KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p><note>
420 /// <p>If the key policy exceeds the length constraint, KMS returns a <code>LimitExceededException</code>.</p>
421 /// </note>
422 /// <p>For help writing and formatting a JSON policy document, see the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html">IAM JSON Policy Reference</a> in the <i> <i>Identity and Access Management User Guide</i> </i>.</p>
423 pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
424 self.policy = input;
425 self
426 }
427 /// <p>The key policy to attach to the KMS key.</p>
428 /// <p>If you provide a key policy, it must meet the following criteria:</p>
429 /// <ul>
430 /// <li>
431 /// <p>The key policy must allow the calling principal to make a subsequent <code>PutKeyPolicy</code> request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>. (To omit this condition, set <code>BypassPolicyLockoutSafetyCheck</code> to true.)</p></li>
432 /// <li>
433 /// <p>Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services principal, you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to KMS. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency">Changes that I make are not always immediately visible</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p></li>
434 /// </ul><note>
435 /// <p>If either of the required <code>Resource</code> or <code>Action</code> elements are missing from a key policy statement, the policy statement has no effect. When a key policy statement is missing one of these elements, the KMS console correctly reports an error, but the <code>CreateKey</code> and <code>PutKeyPolicy</code> API requests succeed, even though the policy statement is ineffective.</p>
436 /// <p>For more information on required key policy elements, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html#key-policy-elements">Elements in a key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
437 /// </note>
438 /// <p>If you do not provide a key policy, KMS attaches a default key policy to the KMS key. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p><note>
439 /// <p>If the key policy exceeds the length constraint, KMS returns a <code>LimitExceededException</code>.</p>
440 /// </note>
441 /// <p>For help writing and formatting a JSON policy document, see the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html">IAM JSON Policy Reference</a> in the <i> <i>Identity and Access Management User Guide</i> </i>.</p>
442 pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
443 &self.policy
444 }
445 /// <p>A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description).</p><important>
446 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
447 /// </important>
448 /// <p>To set or change the description after the key is created, use <code>UpdateKeyDescription</code>.</p>
449 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
450 self.description = ::std::option::Option::Some(input.into());
451 self
452 }
453 /// <p>A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description).</p><important>
454 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
455 /// </important>
456 /// <p>To set or change the description after the key is created, use <code>UpdateKeyDescription</code>.</p>
457 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
458 self.description = input;
459 self
460 }
461 /// <p>A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description).</p><important>
462 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
463 /// </important>
464 /// <p>To set or change the description after the key is created, use <code>UpdateKeyDescription</code>.</p>
465 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
466 &self.description
467 }
468 /// <p>Determines the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a> for which you can use the KMS key. The default value is <code>ENCRYPT_DECRYPT</code>. This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#key-usage"> <code>KeyUsage</code> </a> value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to <a href="https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final">NIST SP 800-57 Recommendations for Key Management</a>, section 5.2, Key usage.</p>
469 /// <p>Select only one valid value.</p>
470 /// <ul>
471 /// <li>
472 /// <p>For symmetric encryption KMS keys, omit the parameter or specify <code>ENCRYPT_DECRYPT</code>.</p></li>
473 /// <li>
474 /// <p>For HMAC KMS keys (symmetric), specify <code>GENERATE_VERIFY_MAC</code>.</p></li>
475 /// <li>
476 /// <p>For asymmetric KMS keys with RSA key pairs, specify <code>ENCRYPT_DECRYPT</code> or <code>SIGN_VERIFY</code>.</p></li>
477 /// <li>
478 /// <p>For asymmetric KMS keys with NIST-standard elliptic curve key pairs, specify <code>SIGN_VERIFY</code> or <code>KEY_AGREEMENT</code>.</p></li>
479 /// <li>
480 /// <p>For asymmetric KMS keys with <code>ECC_SECG_P256K1</code> key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
481 /// <li>
482 /// <p>For asymmetric KMS keys with ML-DSA key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
483 /// <li>
484 /// <p>For asymmetric KMS keys with ML-KEM key pairs, specify <code>ENCAPSULATE_DECAPSULATE</code>.</p></li>
485 /// <li>
486 /// <p>For asymmetric KMS keys with SM2 key pairs (China Regions only), specify <code>ENCRYPT_DECRYPT</code>, <code>SIGN_VERIFY</code>, or <code>KEY_AGREEMENT</code>.</p></li>
487 /// </ul>
488 pub fn key_usage(mut self, input: crate::types::KeyUsageType) -> Self {
489 self.key_usage = ::std::option::Option::Some(input);
490 self
491 }
492 /// <p>Determines the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a> for which you can use the KMS key. The default value is <code>ENCRYPT_DECRYPT</code>. This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#key-usage"> <code>KeyUsage</code> </a> value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to <a href="https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final">NIST SP 800-57 Recommendations for Key Management</a>, section 5.2, Key usage.</p>
493 /// <p>Select only one valid value.</p>
494 /// <ul>
495 /// <li>
496 /// <p>For symmetric encryption KMS keys, omit the parameter or specify <code>ENCRYPT_DECRYPT</code>.</p></li>
497 /// <li>
498 /// <p>For HMAC KMS keys (symmetric), specify <code>GENERATE_VERIFY_MAC</code>.</p></li>
499 /// <li>
500 /// <p>For asymmetric KMS keys with RSA key pairs, specify <code>ENCRYPT_DECRYPT</code> or <code>SIGN_VERIFY</code>.</p></li>
501 /// <li>
502 /// <p>For asymmetric KMS keys with NIST-standard elliptic curve key pairs, specify <code>SIGN_VERIFY</code> or <code>KEY_AGREEMENT</code>.</p></li>
503 /// <li>
504 /// <p>For asymmetric KMS keys with <code>ECC_SECG_P256K1</code> key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
505 /// <li>
506 /// <p>For asymmetric KMS keys with ML-DSA key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
507 /// <li>
508 /// <p>For asymmetric KMS keys with ML-KEM key pairs, specify <code>ENCAPSULATE_DECAPSULATE</code>.</p></li>
509 /// <li>
510 /// <p>For asymmetric KMS keys with SM2 key pairs (China Regions only), specify <code>ENCRYPT_DECRYPT</code>, <code>SIGN_VERIFY</code>, or <code>KEY_AGREEMENT</code>.</p></li>
511 /// </ul>
512 pub fn set_key_usage(mut self, input: ::std::option::Option<crate::types::KeyUsageType>) -> Self {
513 self.key_usage = input;
514 self
515 }
516 /// <p>Determines the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html#cryptographic-operations">cryptographic operations</a> for which you can use the KMS key. The default value is <code>ENCRYPT_DECRYPT</code>. This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#key-usage"> <code>KeyUsage</code> </a> value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to <a href="https://csrc.nist.gov/pubs/sp/800/57/pt1/r5/final">NIST SP 800-57 Recommendations for Key Management</a>, section 5.2, Key usage.</p>
517 /// <p>Select only one valid value.</p>
518 /// <ul>
519 /// <li>
520 /// <p>For symmetric encryption KMS keys, omit the parameter or specify <code>ENCRYPT_DECRYPT</code>.</p></li>
521 /// <li>
522 /// <p>For HMAC KMS keys (symmetric), specify <code>GENERATE_VERIFY_MAC</code>.</p></li>
523 /// <li>
524 /// <p>For asymmetric KMS keys with RSA key pairs, specify <code>ENCRYPT_DECRYPT</code> or <code>SIGN_VERIFY</code>.</p></li>
525 /// <li>
526 /// <p>For asymmetric KMS keys with NIST-standard elliptic curve key pairs, specify <code>SIGN_VERIFY</code> or <code>KEY_AGREEMENT</code>.</p></li>
527 /// <li>
528 /// <p>For asymmetric KMS keys with <code>ECC_SECG_P256K1</code> key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
529 /// <li>
530 /// <p>For asymmetric KMS keys with ML-DSA key pairs, specify <code>SIGN_VERIFY</code>.</p></li>
531 /// <li>
532 /// <p>For asymmetric KMS keys with ML-KEM key pairs, specify <code>ENCAPSULATE_DECAPSULATE</code>.</p></li>
533 /// <li>
534 /// <p>For asymmetric KMS keys with SM2 key pairs (China Regions only), specify <code>ENCRYPT_DECRYPT</code>, <code>SIGN_VERIFY</code>, or <code>KEY_AGREEMENT</code>.</p></li>
535 /// </ul>
536 pub fn get_key_usage(&self) -> &::std::option::Option<crate::types::KeyUsageType> {
537 &self.key_usage
538 }
539 /// <p>Instead, use the <code>KeySpec</code> parameter.</p>
540 /// <p>The <code>KeySpec</code> and <code>CustomerMasterKeySpec</code> parameters work the same way. Only the names differ. We recommend that you use <code>KeySpec</code> parameter in your code. However, to avoid breaking changes, KMS supports both parameters.</p>
541 #[deprecated(note = "This parameter has been deprecated. Instead, use the KeySpec parameter.")]
542 pub fn customer_master_key_spec(mut self, input: crate::types::CustomerMasterKeySpec) -> Self {
543 self.customer_master_key_spec = ::std::option::Option::Some(input);
544 self
545 }
546 /// <p>Instead, use the <code>KeySpec</code> parameter.</p>
547 /// <p>The <code>KeySpec</code> and <code>CustomerMasterKeySpec</code> parameters work the same way. Only the names differ. We recommend that you use <code>KeySpec</code> parameter in your code. However, to avoid breaking changes, KMS supports both parameters.</p>
548 #[deprecated(note = "This parameter has been deprecated. Instead, use the KeySpec parameter.")]
549 pub fn set_customer_master_key_spec(mut self, input: ::std::option::Option<crate::types::CustomerMasterKeySpec>) -> Self {
550 self.customer_master_key_spec = input;
551 self
552 }
553 /// <p>Instead, use the <code>KeySpec</code> parameter.</p>
554 /// <p>The <code>KeySpec</code> and <code>CustomerMasterKeySpec</code> parameters work the same way. Only the names differ. We recommend that you use <code>KeySpec</code> parameter in your code. However, to avoid breaking changes, KMS supports both parameters.</p>
555 #[deprecated(note = "This parameter has been deprecated. Instead, use the KeySpec parameter.")]
556 pub fn get_customer_master_key_spec(&self) -> &::std::option::Option<crate::types::CustomerMasterKeySpec> {
557 &self.customer_master_key_spec
558 }
559 /// <p>Specifies the type of KMS key to create. The default value, <code>SYMMETRIC_DEFAULT</code>, creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose-key-spec.html">Key spec reference</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
560 /// <p>The <code>KeySpec</code> determines whether the KMS key contains a symmetric key or an asymmetric key pair. It also determines the algorithms that the KMS key supports. You can't change the <code>KeySpec</code> after the KMS key is created. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-encryption-algorithm">kms:EncryptionAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-mac-algorithm">kms:MacAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-key-agreement-algorithm">kms:KeyAgreementAlgorithm</a>, or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-signing-algorithm">kms:SigningAlgorithm</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p><important>
561 /// <p><a href="http://aws.amazon.com/kms/features/#AWS_Service_Integration">Amazon Web Services services that are integrated with KMS</a> use symmetric encryption KMS keys to protect your data. These services do not support asymmetric KMS keys or HMAC KMS keys.</p>
562 /// </important>
563 /// <p>KMS supports the following key specs for KMS keys:</p>
564 /// <ul>
565 /// <li>
566 /// <p>Symmetric encryption key (default)</p>
567 /// <ul>
568 /// <li>
569 /// <p><code>SYMMETRIC_DEFAULT</code></p></li>
570 /// </ul></li>
571 /// <li>
572 /// <p>HMAC keys (symmetric)</p>
573 /// <ul>
574 /// <li>
575 /// <p><code>HMAC_224</code></p></li>
576 /// <li>
577 /// <p><code>HMAC_256</code></p></li>
578 /// <li>
579 /// <p><code>HMAC_384</code></p></li>
580 /// <li>
581 /// <p><code>HMAC_512</code></p></li>
582 /// </ul></li>
583 /// <li>
584 /// <p>Asymmetric RSA key pairs (encryption and decryption -or- signing and verification)</p>
585 /// <ul>
586 /// <li>
587 /// <p><code>RSA_2048</code></p></li>
588 /// <li>
589 /// <p><code>RSA_3072</code></p></li>
590 /// <li>
591 /// <p><code>RSA_4096</code></p></li>
592 /// </ul></li>
593 /// <li>
594 /// <p>Asymmetric NIST-standard elliptic curve key pairs (signing and verification -or- deriving shared secrets)</p>
595 /// <ul>
596 /// <li>
597 /// <p><code>ECC_NIST_P256</code> (secp256r1)</p></li>
598 /// <li>
599 /// <p><code>ECC_NIST_P384</code> (secp384r1)</p></li>
600 /// <li>
601 /// <p><code>ECC_NIST_P521</code> (secp521r1)</p></li>
602 /// <li>
603 /// <p><code>ECC_NIST_EDWARDS25519</code> (ed25519) - signing and verification only</p>
604 /// <ul>
605 /// <li>
606 /// <p><b>Note:</b> For ECC_NIST_EDWARDS25519 KMS keys, the ED25519_SHA_512 signing algorithm requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:RAW</code> </a>, while ED25519_PH_SHA_512 requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:DIGEST</code> </a>. These message types cannot be used interchangeably.</p></li>
607 /// </ul></li>
608 /// </ul></li>
609 /// <li>
610 /// <p>Other asymmetric elliptic curve key pairs (signing and verification)</p>
611 /// <ul>
612 /// <li>
613 /// <p><code>ECC_SECG_P256K1</code> (secp256k1), commonly used for cryptocurrencies.</p></li>
614 /// </ul></li>
615 /// <li>
616 /// <p>Asymmetric ML-DSA key pairs (signing and verification)</p>
617 /// <ul>
618 /// <li>
619 /// <p><code>ML_DSA_44</code></p></li>
620 /// <li>
621 /// <p><code>ML_DSA_65</code></p></li>
622 /// <li>
623 /// <p><code>ML_DSA_87</code></p></li>
624 /// </ul></li>
625 /// <li>
626 /// <p>Asymmetric ML-KEM key pairs (establishing shared secrets)</p>
627 /// <ul>
628 /// <li>
629 /// <p><code>ML_KEM_512</code></p></li>
630 /// <li>
631 /// <p><code>ML_KEM_768</code></p></li>
632 /// <li>
633 /// <p><code>ML_KEM_1024</code></p></li>
634 /// </ul>
635 /// <p>The ML-KEM key specs are not available in China Regions.</p></li>
636 /// <li>
637 /// <p>SM2 key pairs (encryption and decryption -or- signing and verification -or- deriving shared secrets)</p>
638 /// <ul>
639 /// <li>
640 /// <p><code>SM2</code> (China Regions only)</p></li>
641 /// </ul></li>
642 /// </ul>
643 pub fn key_spec(mut self, input: crate::types::KeySpec) -> Self {
644 self.key_spec = ::std::option::Option::Some(input);
645 self
646 }
647 /// <p>Specifies the type of KMS key to create. The default value, <code>SYMMETRIC_DEFAULT</code>, creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose-key-spec.html">Key spec reference</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
648 /// <p>The <code>KeySpec</code> determines whether the KMS key contains a symmetric key or an asymmetric key pair. It also determines the algorithms that the KMS key supports. You can't change the <code>KeySpec</code> after the KMS key is created. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-encryption-algorithm">kms:EncryptionAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-mac-algorithm">kms:MacAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-key-agreement-algorithm">kms:KeyAgreementAlgorithm</a>, or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-signing-algorithm">kms:SigningAlgorithm</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p><important>
649 /// <p><a href="http://aws.amazon.com/kms/features/#AWS_Service_Integration">Amazon Web Services services that are integrated with KMS</a> use symmetric encryption KMS keys to protect your data. These services do not support asymmetric KMS keys or HMAC KMS keys.</p>
650 /// </important>
651 /// <p>KMS supports the following key specs for KMS keys:</p>
652 /// <ul>
653 /// <li>
654 /// <p>Symmetric encryption key (default)</p>
655 /// <ul>
656 /// <li>
657 /// <p><code>SYMMETRIC_DEFAULT</code></p></li>
658 /// </ul></li>
659 /// <li>
660 /// <p>HMAC keys (symmetric)</p>
661 /// <ul>
662 /// <li>
663 /// <p><code>HMAC_224</code></p></li>
664 /// <li>
665 /// <p><code>HMAC_256</code></p></li>
666 /// <li>
667 /// <p><code>HMAC_384</code></p></li>
668 /// <li>
669 /// <p><code>HMAC_512</code></p></li>
670 /// </ul></li>
671 /// <li>
672 /// <p>Asymmetric RSA key pairs (encryption and decryption -or- signing and verification)</p>
673 /// <ul>
674 /// <li>
675 /// <p><code>RSA_2048</code></p></li>
676 /// <li>
677 /// <p><code>RSA_3072</code></p></li>
678 /// <li>
679 /// <p><code>RSA_4096</code></p></li>
680 /// </ul></li>
681 /// <li>
682 /// <p>Asymmetric NIST-standard elliptic curve key pairs (signing and verification -or- deriving shared secrets)</p>
683 /// <ul>
684 /// <li>
685 /// <p><code>ECC_NIST_P256</code> (secp256r1)</p></li>
686 /// <li>
687 /// <p><code>ECC_NIST_P384</code> (secp384r1)</p></li>
688 /// <li>
689 /// <p><code>ECC_NIST_P521</code> (secp521r1)</p></li>
690 /// <li>
691 /// <p><code>ECC_NIST_EDWARDS25519</code> (ed25519) - signing and verification only</p>
692 /// <ul>
693 /// <li>
694 /// <p><b>Note:</b> For ECC_NIST_EDWARDS25519 KMS keys, the ED25519_SHA_512 signing algorithm requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:RAW</code> </a>, while ED25519_PH_SHA_512 requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:DIGEST</code> </a>. These message types cannot be used interchangeably.</p></li>
695 /// </ul></li>
696 /// </ul></li>
697 /// <li>
698 /// <p>Other asymmetric elliptic curve key pairs (signing and verification)</p>
699 /// <ul>
700 /// <li>
701 /// <p><code>ECC_SECG_P256K1</code> (secp256k1), commonly used for cryptocurrencies.</p></li>
702 /// </ul></li>
703 /// <li>
704 /// <p>Asymmetric ML-DSA key pairs (signing and verification)</p>
705 /// <ul>
706 /// <li>
707 /// <p><code>ML_DSA_44</code></p></li>
708 /// <li>
709 /// <p><code>ML_DSA_65</code></p></li>
710 /// <li>
711 /// <p><code>ML_DSA_87</code></p></li>
712 /// </ul></li>
713 /// <li>
714 /// <p>Asymmetric ML-KEM key pairs (establishing shared secrets)</p>
715 /// <ul>
716 /// <li>
717 /// <p><code>ML_KEM_512</code></p></li>
718 /// <li>
719 /// <p><code>ML_KEM_768</code></p></li>
720 /// <li>
721 /// <p><code>ML_KEM_1024</code></p></li>
722 /// </ul>
723 /// <p>The ML-KEM key specs are not available in China Regions.</p></li>
724 /// <li>
725 /// <p>SM2 key pairs (encryption and decryption -or- signing and verification -or- deriving shared secrets)</p>
726 /// <ul>
727 /// <li>
728 /// <p><code>SM2</code> (China Regions only)</p></li>
729 /// </ul></li>
730 /// </ul>
731 pub fn set_key_spec(mut self, input: ::std::option::Option<crate::types::KeySpec>) -> Self {
732 self.key_spec = input;
733 self
734 }
735 /// <p>Specifies the type of KMS key to create. The default value, <code>SYMMETRIC_DEFAULT</code>, creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose-key-spec.html">Key spec reference</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
736 /// <p>The <code>KeySpec</code> determines whether the KMS key contains a symmetric key or an asymmetric key pair. It also determines the algorithms that the KMS key supports. You can't change the <code>KeySpec</code> after the KMS key is created. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-encryption-algorithm">kms:EncryptionAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-mac-algorithm">kms:MacAlgorithm</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-key-agreement-algorithm">kms:KeyAgreementAlgorithm</a>, or <a href="https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-signing-algorithm">kms:SigningAlgorithm</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p><important>
737 /// <p><a href="http://aws.amazon.com/kms/features/#AWS_Service_Integration">Amazon Web Services services that are integrated with KMS</a> use symmetric encryption KMS keys to protect your data. These services do not support asymmetric KMS keys or HMAC KMS keys.</p>
738 /// </important>
739 /// <p>KMS supports the following key specs for KMS keys:</p>
740 /// <ul>
741 /// <li>
742 /// <p>Symmetric encryption key (default)</p>
743 /// <ul>
744 /// <li>
745 /// <p><code>SYMMETRIC_DEFAULT</code></p></li>
746 /// </ul></li>
747 /// <li>
748 /// <p>HMAC keys (symmetric)</p>
749 /// <ul>
750 /// <li>
751 /// <p><code>HMAC_224</code></p></li>
752 /// <li>
753 /// <p><code>HMAC_256</code></p></li>
754 /// <li>
755 /// <p><code>HMAC_384</code></p></li>
756 /// <li>
757 /// <p><code>HMAC_512</code></p></li>
758 /// </ul></li>
759 /// <li>
760 /// <p>Asymmetric RSA key pairs (encryption and decryption -or- signing and verification)</p>
761 /// <ul>
762 /// <li>
763 /// <p><code>RSA_2048</code></p></li>
764 /// <li>
765 /// <p><code>RSA_3072</code></p></li>
766 /// <li>
767 /// <p><code>RSA_4096</code></p></li>
768 /// </ul></li>
769 /// <li>
770 /// <p>Asymmetric NIST-standard elliptic curve key pairs (signing and verification -or- deriving shared secrets)</p>
771 /// <ul>
772 /// <li>
773 /// <p><code>ECC_NIST_P256</code> (secp256r1)</p></li>
774 /// <li>
775 /// <p><code>ECC_NIST_P384</code> (secp384r1)</p></li>
776 /// <li>
777 /// <p><code>ECC_NIST_P521</code> (secp521r1)</p></li>
778 /// <li>
779 /// <p><code>ECC_NIST_EDWARDS25519</code> (ed25519) - signing and verification only</p>
780 /// <ul>
781 /// <li>
782 /// <p><b>Note:</b> For ECC_NIST_EDWARDS25519 KMS keys, the ED25519_SHA_512 signing algorithm requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:RAW</code> </a>, while ED25519_PH_SHA_512 requires <a href="kms/latest/APIReference/API_Sign.html#KMS-Sign-request-MessageType"> <code>MessageType:DIGEST</code> </a>. These message types cannot be used interchangeably.</p></li>
783 /// </ul></li>
784 /// </ul></li>
785 /// <li>
786 /// <p>Other asymmetric elliptic curve key pairs (signing and verification)</p>
787 /// <ul>
788 /// <li>
789 /// <p><code>ECC_SECG_P256K1</code> (secp256k1), commonly used for cryptocurrencies.</p></li>
790 /// </ul></li>
791 /// <li>
792 /// <p>Asymmetric ML-DSA key pairs (signing and verification)</p>
793 /// <ul>
794 /// <li>
795 /// <p><code>ML_DSA_44</code></p></li>
796 /// <li>
797 /// <p><code>ML_DSA_65</code></p></li>
798 /// <li>
799 /// <p><code>ML_DSA_87</code></p></li>
800 /// </ul></li>
801 /// <li>
802 /// <p>Asymmetric ML-KEM key pairs (establishing shared secrets)</p>
803 /// <ul>
804 /// <li>
805 /// <p><code>ML_KEM_512</code></p></li>
806 /// <li>
807 /// <p><code>ML_KEM_768</code></p></li>
808 /// <li>
809 /// <p><code>ML_KEM_1024</code></p></li>
810 /// </ul>
811 /// <p>The ML-KEM key specs are not available in China Regions.</p></li>
812 /// <li>
813 /// <p>SM2 key pairs (encryption and decryption -or- signing and verification -or- deriving shared secrets)</p>
814 /// <ul>
815 /// <li>
816 /// <p><code>SM2</code> (China Regions only)</p></li>
817 /// </ul></li>
818 /// </ul>
819 pub fn get_key_spec(&self) -> &::std::option::Option<crate::types::KeySpec> {
820 &self.key_spec
821 }
822 /// <p>The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is <code>AWS_KMS</code>, which means that KMS creates the key material.</p>
823 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html">create a KMS key with no key material</a> (for imported key material), set this value to <code>EXTERNAL</code>. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>. The <code>EXTERNAL</code> origin value is valid only for symmetric KMS keys.</p>
824 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html">create a KMS key in an CloudHSM key store</a> and create its key material in the associated CloudHSM cluster, set this value to <code>AWS_CLOUDHSM</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the CloudHSM key store. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
825 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html">create a KMS key in an external key store</a>, set this value to <code>EXTERNAL_KEY_STORE</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the external key store and the <code>XksKeyId</code> parameter to identify the associated external key. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
826 pub fn origin(mut self, input: crate::types::OriginType) -> Self {
827 self.origin = ::std::option::Option::Some(input);
828 self
829 }
830 /// <p>The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is <code>AWS_KMS</code>, which means that KMS creates the key material.</p>
831 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html">create a KMS key with no key material</a> (for imported key material), set this value to <code>EXTERNAL</code>. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>. The <code>EXTERNAL</code> origin value is valid only for symmetric KMS keys.</p>
832 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html">create a KMS key in an CloudHSM key store</a> and create its key material in the associated CloudHSM cluster, set this value to <code>AWS_CLOUDHSM</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the CloudHSM key store. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
833 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html">create a KMS key in an external key store</a>, set this value to <code>EXTERNAL_KEY_STORE</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the external key store and the <code>XksKeyId</code> parameter to identify the associated external key. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
834 pub fn set_origin(mut self, input: ::std::option::Option<crate::types::OriginType>) -> Self {
835 self.origin = input;
836 self
837 }
838 /// <p>The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is <code>AWS_KMS</code>, which means that KMS creates the key material.</p>
839 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html">create a KMS key with no key material</a> (for imported key material), set this value to <code>EXTERNAL</code>. For more information about importing key material into KMS, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html">Importing Key Material</a> in the <i>Key Management Service Developer Guide</i>. The <code>EXTERNAL</code> origin value is valid only for symmetric KMS keys.</p>
840 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html">create a KMS key in an CloudHSM key store</a> and create its key material in the associated CloudHSM cluster, set this value to <code>AWS_CLOUDHSM</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the CloudHSM key store. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
841 /// <p>To <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html">create a KMS key in an external key store</a>, set this value to <code>EXTERNAL_KEY_STORE</code>. You must also use the <code>CustomKeyStoreId</code> parameter to identify the external key store and the <code>XksKeyId</code> parameter to identify the associated external key. The <code>KeySpec</code> value must be <code>SYMMETRIC_DEFAULT</code>.</p>
842 pub fn get_origin(&self) -> &::std::option::Option<crate::types::OriginType> {
843 &self.origin
844 }
845 /// <p>Creates the KMS key in the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key store</a>. The <code>ConnectionState</code> of the custom key store must be <code>CONNECTED</code>. To find the CustomKeyStoreID and ConnectionState use the <code>DescribeCustomKeyStores</code> operation.</p>
846 /// <p>This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store.</p>
847 /// <p>When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable 256-bit symmetric key in its associated CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you must use the <code>XksKeyId</code> parameter to specify an external key that serves as key material for the KMS key.</p>
848 pub fn custom_key_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
849 self.custom_key_store_id = ::std::option::Option::Some(input.into());
850 self
851 }
852 /// <p>Creates the KMS key in the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key store</a>. The <code>ConnectionState</code> of the custom key store must be <code>CONNECTED</code>. To find the CustomKeyStoreID and ConnectionState use the <code>DescribeCustomKeyStores</code> operation.</p>
853 /// <p>This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store.</p>
854 /// <p>When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable 256-bit symmetric key in its associated CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you must use the <code>XksKeyId</code> parameter to specify an external key that serves as key material for the KMS key.</p>
855 pub fn set_custom_key_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
856 self.custom_key_store_id = input;
857 self
858 }
859 /// <p>Creates the KMS key in the specified <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key store</a>. The <code>ConnectionState</code> of the custom key store must be <code>CONNECTED</code>. To find the CustomKeyStoreID and ConnectionState use the <code>DescribeCustomKeyStores</code> operation.</p>
860 /// <p>This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store.</p>
861 /// <p>When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable 256-bit symmetric key in its associated CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you must use the <code>XksKeyId</code> parameter to specify an external key that serves as key material for the KMS key.</p>
862 pub fn get_custom_key_store_id(&self) -> &::std::option::Option<::std::string::String> {
863 &self.custom_key_store_id
864 }
865 /// <p>Skips ("bypasses") the key policy lockout safety check. The default value is false.</p><important>
866 /// <p>Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.</p>
867 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
868 /// </important>
869 /// <p>Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a> request on the KMS key.</p>
870 pub fn bypass_policy_lockout_safety_check(mut self, input: bool) -> Self {
871 self.bypass_policy_lockout_safety_check = ::std::option::Option::Some(input);
872 self
873 }
874 /// <p>Skips ("bypasses") the key policy lockout safety check. The default value is false.</p><important>
875 /// <p>Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.</p>
876 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
877 /// </important>
878 /// <p>Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a> request on the KMS key.</p>
879 pub fn set_bypass_policy_lockout_safety_check(mut self, input: ::std::option::Option<bool>) -> Self {
880 self.bypass_policy_lockout_safety_check = input;
881 self
882 }
883 /// <p>Skips ("bypasses") the key policy lockout safety check. The default value is false.</p><important>
884 /// <p>Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately.</p>
885 /// <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key">Default key policy</a> in the <i>Key Management Service Developer Guide</i>.</p>
886 /// </important>
887 /// <p>Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html">PutKeyPolicy</a> request on the KMS key.</p>
888 pub fn get_bypass_policy_lockout_safety_check(&self) -> &::std::option::Option<bool> {
889 &self.bypass_policy_lockout_safety_check
890 }
891 /// Appends an item to `tags`.
892 ///
893 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
894 ///
895 /// <p>Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the <code>TagResource</code> operation.</p><important>
896 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
897 /// </important> <note>
898 /// <p>Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
899 /// </note>
900 /// <p>To use this parameter, you must have <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:TagResource</a> permission in an IAM policy.</p>
901 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, KMS replaces the current tag value with the specified one.</p>
902 /// <p>When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html">Tags in KMS</a>.</p>
903 pub fn tags(mut self, input: crate::types::Tag) -> Self {
904 let mut v = self.tags.unwrap_or_default();
905 v.push(input);
906 self.tags = ::std::option::Option::Some(v);
907 self
908 }
909 /// <p>Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the <code>TagResource</code> operation.</p><important>
910 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
911 /// </important> <note>
912 /// <p>Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
913 /// </note>
914 /// <p>To use this parameter, you must have <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:TagResource</a> permission in an IAM policy.</p>
915 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, KMS replaces the current tag value with the specified one.</p>
916 /// <p>When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html">Tags in KMS</a>.</p>
917 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
918 self.tags = input;
919 self
920 }
921 /// <p>Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the <code>TagResource</code> operation.</p><important>
922 /// <p>Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.</p>
923 /// </important> <note>
924 /// <p>Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/abac.html">ABAC for KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
925 /// </note>
926 /// <p>To use this parameter, you must have <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:TagResource</a> permission in an IAM policy.</p>
927 /// <p>Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, KMS replaces the current tag value with the specified one.</p>
928 /// <p>When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html">Tags in KMS</a>.</p>
929 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
930 &self.tags
931 }
932 /// <p>Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key.</p>
933 /// <p>For a multi-Region key, set this parameter to <code>True</code>. For a single-Region KMS key, omit this parameter or set it to <code>False</code>. The default value is <code>False</code>.</p>
934 /// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
935 /// <p>This value creates a <i>primary key</i>, not a replica. To create a <i>replica key</i>, use the <code>ReplicateKey</code> operation.</p>
936 /// <p>You can create a symmetric or asymmetric multi-Region key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store.</p>
937 pub fn multi_region(mut self, input: bool) -> Self {
938 self.multi_region = ::std::option::Option::Some(input);
939 self
940 }
941 /// <p>Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key.</p>
942 /// <p>For a multi-Region key, set this parameter to <code>True</code>. For a single-Region KMS key, omit this parameter or set it to <code>False</code>. The default value is <code>False</code>.</p>
943 /// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
944 /// <p>This value creates a <i>primary key</i>, not a replica. To create a <i>replica key</i>, use the <code>ReplicateKey</code> operation.</p>
945 /// <p>You can create a symmetric or asymmetric multi-Region key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store.</p>
946 pub fn set_multi_region(mut self, input: ::std::option::Option<bool>) -> Self {
947 self.multi_region = input;
948 self
949 }
950 /// <p>Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key.</p>
951 /// <p>For a multi-Region key, set this parameter to <code>True</code>. For a single-Region KMS key, omit this parameter or set it to <code>False</code>. The default value is <code>False</code>.</p>
952 /// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
953 /// <p>This value creates a <i>primary key</i>, not a replica. To create a <i>replica key</i>, use the <code>ReplicateKey</code> operation.</p>
954 /// <p>You can create a symmetric or asymmetric multi-Region key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store.</p>
955 pub fn get_multi_region(&self) -> &::std::option::Option<bool> {
956 &self.multi_region
957 }
958 /// <p>Identifies the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key">external key</a> that serves as key material for the KMS key in an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key store</a>. Specify the ID that the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy">external key store proxy</a> uses to refer to the external key. For help, see the documentation for your external key store proxy.</p>
959 /// <p>This parameter is required for a KMS key with an <code>Origin</code> value of <code>EXTERNAL_KEY_STORE</code>. It is not valid for KMS keys with any other <code>Origin</code> value.</p>
960 /// <p>The external key must be an existing 256-bit AES symmetric encryption key hosted outside of Amazon Web Services in an external key manager associated with the external key store specified by the <code>CustomKeyStoreId</code> parameter. This key must be enabled and configured to perform encryption and decryption. Each KMS key in an external key store must use a different external key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html#xks-key-requirements">Requirements for a KMS key in an external key store</a> in the <i>Key Management Service Developer Guide</i>.</p>
961 /// <p>Each KMS key in an external key store is associated two backing keys. One is key material that KMS generates. The other is the external key specified by this parameter. When you use the KMS key in an external key store to encrypt data, the encryption operation is performed first by KMS using the KMS key material, and then by the external key manager using the specified external key, a process known as <i>double encryption</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption">Double encryption</a> in the <i>Key Management Service Developer Guide</i>.</p>
962 pub fn xks_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
963 self.xks_key_id = ::std::option::Option::Some(input.into());
964 self
965 }
966 /// <p>Identifies the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key">external key</a> that serves as key material for the KMS key in an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key store</a>. Specify the ID that the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy">external key store proxy</a> uses to refer to the external key. For help, see the documentation for your external key store proxy.</p>
967 /// <p>This parameter is required for a KMS key with an <code>Origin</code> value of <code>EXTERNAL_KEY_STORE</code>. It is not valid for KMS keys with any other <code>Origin</code> value.</p>
968 /// <p>The external key must be an existing 256-bit AES symmetric encryption key hosted outside of Amazon Web Services in an external key manager associated with the external key store specified by the <code>CustomKeyStoreId</code> parameter. This key must be enabled and configured to perform encryption and decryption. Each KMS key in an external key store must use a different external key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html#xks-key-requirements">Requirements for a KMS key in an external key store</a> in the <i>Key Management Service Developer Guide</i>.</p>
969 /// <p>Each KMS key in an external key store is associated two backing keys. One is key material that KMS generates. The other is the external key specified by this parameter. When you use the KMS key in an external key store to encrypt data, the encryption operation is performed first by KMS using the KMS key material, and then by the external key manager using the specified external key, a process known as <i>double encryption</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption">Double encryption</a> in the <i>Key Management Service Developer Guide</i>.</p>
970 pub fn set_xks_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
971 self.xks_key_id = input;
972 self
973 }
974 /// <p>Identifies the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key">external key</a> that serves as key material for the KMS key in an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html">external key store</a>. Specify the ID that the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy">external key store proxy</a> uses to refer to the external key. For help, see the documentation for your external key store proxy.</p>
975 /// <p>This parameter is required for a KMS key with an <code>Origin</code> value of <code>EXTERNAL_KEY_STORE</code>. It is not valid for KMS keys with any other <code>Origin</code> value.</p>
976 /// <p>The external key must be an existing 256-bit AES symmetric encryption key hosted outside of Amazon Web Services in an external key manager associated with the external key store specified by the <code>CustomKeyStoreId</code> parameter. This key must be enabled and configured to perform encryption and decryption. Each KMS key in an external key store must use a different external key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html#xks-key-requirements">Requirements for a KMS key in an external key store</a> in the <i>Key Management Service Developer Guide</i>.</p>
977 /// <p>Each KMS key in an external key store is associated two backing keys. One is key material that KMS generates. The other is the external key specified by this parameter. When you use the KMS key in an external key store to encrypt data, the encryption operation is performed first by KMS using the KMS key material, and then by the external key manager using the specified external key, a process known as <i>double encryption</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption">Double encryption</a> in the <i>Key Management Service Developer Guide</i>.</p>
978 pub fn get_xks_key_id(&self) -> &::std::option::Option<::std::string::String> {
979 &self.xks_key_id
980 }
981 /// Consumes the builder and constructs a [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
982 pub fn build(self) -> ::std::result::Result<crate::operation::create_key::CreateKeyInput, ::aws_smithy_types::error::operation::BuildError> {
983 ::std::result::Result::Ok(crate::operation::create_key::CreateKeyInput {
984 policy: self.policy,
985 description: self.description,
986 key_usage: self.key_usage,
987 customer_master_key_spec: self.customer_master_key_spec,
988 key_spec: self.key_spec,
989 origin: self.origin,
990 custom_key_store_id: self.custom_key_store_id,
991 bypass_policy_lockout_safety_check: self.bypass_policy_lockout_safety_check,
992 tags: self.tags,
993 multi_region: self.multi_region,
994 xks_key_id: self.xks_key_id,
995 })
996 }
997}