aws_sdk_kms/operation/sign/_sign_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)]
5pub struct SignInput {
6 /// <p>Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to sign the message. The <code>KeyUsage</code> type of the KMS key must be <code>SIGN_VERIFY</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
7 /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
8 /// <p>For example:</p>
9 /// <ul>
10 /// <li>
11 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
12 /// <li>
13 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
14 /// <li>
15 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
16 /// <li>
17 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
18 /// </ul>
19 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
20 pub key_id: ::std::option::Option<::std::string::String>,
21 /// <p>Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a larger message, provide a message digest.</p>
22 /// <p>If you provide a message digest, use the <code>DIGEST</code> value of <code>MessageType</code> to prevent the digest from being hashed again while signing.</p>
23 pub message: ::std::option::Option<::aws_smithy_types::Blob>,
24 /// <p>Tells KMS whether the value of the <code>Message</code> parameter should be hashed as part of the signing algorithm. Use <code>RAW</code> for unhashed messages; use <code>DIGEST</code> for message digests, which are already hashed; use <code>EXTERNAL_MU</code> for 64-byte representative μ used in ML-DSA signing as defined in NIST FIPS 204 Section 6.2.</p>
25 /// <p>When the value of <code>MessageType</code> is <code>RAW</code>, KMS uses the standard signing algorithm, which begins with a hash function. When the value is <code>DIGEST</code>, KMS skips the hashing step in the signing algorithm. When the value is <code>EXTERNAL_MU</code> KMS skips the concatenated hashing of the public key hash and the message done in the ML-DSA signing algorithm.</p><important>
26 /// <p>Use the <code>DIGEST</code> or <code>EXTERNAL_MU</code> value only when the value of the <code>Message</code> parameter is a message digest. If you use the <code>DIGEST</code> value with an unhashed message, the security of the signing operation can be compromised.</p>
27 /// </important>
28 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
29 /// <ul>
30 /// <li>
31 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
32 /// <li>
33 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
34 /// </ul><important>
35 /// <p>When you specify the ED25519_PH_SHA_512 signing algorithm with <code>MessageType:DIGEST</code>, KMS still performs the SHA-512 prehash described in <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf#page=39">Step 1 of Section 7.8.1 in FIPS 186-5</a>. This means the input is hashed twice: once by you and once by KMS.</p>
36 /// </important>
37 /// <p>When the value of <code>MessageType</code> is <code>DIGEST</code>, the length of the <code>Message</code> value must match the length of hashed messages for the specified signing algorithm.</p>
38 /// <p>When the value of <code>MessageType</code> is <code>EXTERNAL_MU</code> the length of the <code>Message</code> value must be 64 bytes.</p>
39 /// <p>You can submit a message digest and omit the <code>MessageType</code> or specify <code>RAW</code> so the digest is hashed again while signing. However, this can cause verification failures when verifying with a system that assumes a single hash.</p>
40 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
41 /// <ul>
42 /// <li>
43 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
44 /// <li>
45 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
46 /// <li>
47 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
48 /// <li>
49 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
50 /// <li>
51 /// <p>SM2DSA uses the SM3 hashing algorithm. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/offline-operations.html#key-spec-sm-offline-verification">Offline verification with SM2 key pairs</a>.</p></li>
52 /// </ul>
53 pub message_type: ::std::option::Option<crate::types::MessageType>,
54 /// <p>A list of grant tokens.</p>
55 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
56 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
57 /// <p>Specifies the signing algorithm to use when signing the message.</p>
58 /// <p>Choose an algorithm that is compatible with the type and size of the specified asymmetric KMS key. When signing with RSA key pairs, RSASSA-PSS algorithms are preferred. We include RSASSA-PKCS1-v1_5 algorithms for compatibility with existing applications.</p>
59 pub signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
60 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
61 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
62 pub dry_run: ::std::option::Option<bool>,
63}
64impl SignInput {
65 /// <p>Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to sign the message. The <code>KeyUsage</code> type of the KMS key must be <code>SIGN_VERIFY</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
66 /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
67 /// <p>For example:</p>
68 /// <ul>
69 /// <li>
70 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
71 /// <li>
72 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
73 /// <li>
74 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
75 /// <li>
76 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
77 /// </ul>
78 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
79 pub fn key_id(&self) -> ::std::option::Option<&str> {
80 self.key_id.as_deref()
81 }
82 /// <p>Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a larger message, provide a message digest.</p>
83 /// <p>If you provide a message digest, use the <code>DIGEST</code> value of <code>MessageType</code> to prevent the digest from being hashed again while signing.</p>
84 pub fn message(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
85 self.message.as_ref()
86 }
87 /// <p>Tells KMS whether the value of the <code>Message</code> parameter should be hashed as part of the signing algorithm. Use <code>RAW</code> for unhashed messages; use <code>DIGEST</code> for message digests, which are already hashed; use <code>EXTERNAL_MU</code> for 64-byte representative μ used in ML-DSA signing as defined in NIST FIPS 204 Section 6.2.</p>
88 /// <p>When the value of <code>MessageType</code> is <code>RAW</code>, KMS uses the standard signing algorithm, which begins with a hash function. When the value is <code>DIGEST</code>, KMS skips the hashing step in the signing algorithm. When the value is <code>EXTERNAL_MU</code> KMS skips the concatenated hashing of the public key hash and the message done in the ML-DSA signing algorithm.</p><important>
89 /// <p>Use the <code>DIGEST</code> or <code>EXTERNAL_MU</code> value only when the value of the <code>Message</code> parameter is a message digest. If you use the <code>DIGEST</code> value with an unhashed message, the security of the signing operation can be compromised.</p>
90 /// </important>
91 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
92 /// <ul>
93 /// <li>
94 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
95 /// <li>
96 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
97 /// </ul><important>
98 /// <p>When you specify the ED25519_PH_SHA_512 signing algorithm with <code>MessageType:DIGEST</code>, KMS still performs the SHA-512 prehash described in <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf#page=39">Step 1 of Section 7.8.1 in FIPS 186-5</a>. This means the input is hashed twice: once by you and once by KMS.</p>
99 /// </important>
100 /// <p>When the value of <code>MessageType</code> is <code>DIGEST</code>, the length of the <code>Message</code> value must match the length of hashed messages for the specified signing algorithm.</p>
101 /// <p>When the value of <code>MessageType</code> is <code>EXTERNAL_MU</code> the length of the <code>Message</code> value must be 64 bytes.</p>
102 /// <p>You can submit a message digest and omit the <code>MessageType</code> or specify <code>RAW</code> so the digest is hashed again while signing. However, this can cause verification failures when verifying with a system that assumes a single hash.</p>
103 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
104 /// <ul>
105 /// <li>
106 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
107 /// <li>
108 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
109 /// <li>
110 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
111 /// <li>
112 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
113 /// <li>
114 /// <p>SM2DSA uses the SM3 hashing algorithm. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/offline-operations.html#key-spec-sm-offline-verification">Offline verification with SM2 key pairs</a>.</p></li>
115 /// </ul>
116 pub fn message_type(&self) -> ::std::option::Option<&crate::types::MessageType> {
117 self.message_type.as_ref()
118 }
119 /// <p>A list of grant tokens.</p>
120 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
121 ///
122 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.grant_tokens.is_none()`.
123 pub fn grant_tokens(&self) -> &[::std::string::String] {
124 self.grant_tokens.as_deref().unwrap_or_default()
125 }
126 /// <p>Specifies the signing algorithm to use when signing the message.</p>
127 /// <p>Choose an algorithm that is compatible with the type and size of the specified asymmetric KMS key. When signing with RSA key pairs, RSASSA-PSS algorithms are preferred. We include RSASSA-PKCS1-v1_5 algorithms for compatibility with existing applications.</p>
128 pub fn signing_algorithm(&self) -> ::std::option::Option<&crate::types::SigningAlgorithmSpec> {
129 self.signing_algorithm.as_ref()
130 }
131 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
132 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
133 pub fn dry_run(&self) -> ::std::option::Option<bool> {
134 self.dry_run
135 }
136}
137impl ::std::fmt::Debug for SignInput {
138 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
139 let mut formatter = f.debug_struct("SignInput");
140 formatter.field("key_id", &self.key_id);
141 formatter.field("message", &"*** Sensitive Data Redacted ***");
142 formatter.field("message_type", &self.message_type);
143 formatter.field("grant_tokens", &self.grant_tokens);
144 formatter.field("signing_algorithm", &self.signing_algorithm);
145 formatter.field("dry_run", &self.dry_run);
146 formatter.finish()
147 }
148}
149impl SignInput {
150 /// Creates a new builder-style object to manufacture [`SignInput`](crate::operation::sign::SignInput).
151 pub fn builder() -> crate::operation::sign::builders::SignInputBuilder {
152 crate::operation::sign::builders::SignInputBuilder::default()
153 }
154}
155
156/// A builder for [`SignInput`](crate::operation::sign::SignInput).
157#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
158#[non_exhaustive]
159pub struct SignInputBuilder {
160 pub(crate) key_id: ::std::option::Option<::std::string::String>,
161 pub(crate) message: ::std::option::Option<::aws_smithy_types::Blob>,
162 pub(crate) message_type: ::std::option::Option<crate::types::MessageType>,
163 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
164 pub(crate) signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
165 pub(crate) dry_run: ::std::option::Option<bool>,
166}
167impl SignInputBuilder {
168 /// <p>Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to sign the message. The <code>KeyUsage</code> type of the KMS key must be <code>SIGN_VERIFY</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
169 /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
170 /// <p>For example:</p>
171 /// <ul>
172 /// <li>
173 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
174 /// <li>
175 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
176 /// <li>
177 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
178 /// <li>
179 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
180 /// </ul>
181 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
182 /// This field is required.
183 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.key_id = ::std::option::Option::Some(input.into());
185 self
186 }
187 /// <p>Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to sign the message. The <code>KeyUsage</code> type of the KMS key must be <code>SIGN_VERIFY</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
188 /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
189 /// <p>For example:</p>
190 /// <ul>
191 /// <li>
192 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
193 /// <li>
194 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
195 /// <li>
196 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
197 /// <li>
198 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
199 /// </ul>
200 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
201 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202 self.key_id = input;
203 self
204 }
205 /// <p>Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to sign the message. The <code>KeyUsage</code> type of the KMS key must be <code>SIGN_VERIFY</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
206 /// <p>To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with <code>"alias/"</code>. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.</p>
207 /// <p>For example:</p>
208 /// <ul>
209 /// <li>
210 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
211 /// <li>
212 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
213 /// <li>
214 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
215 /// <li>
216 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
217 /// </ul>
218 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>. To get the alias name and alias ARN, use <code>ListAliases</code>.</p>
219 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
220 &self.key_id
221 }
222 /// <p>Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a larger message, provide a message digest.</p>
223 /// <p>If you provide a message digest, use the <code>DIGEST</code> value of <code>MessageType</code> to prevent the digest from being hashed again while signing.</p>
224 /// This field is required.
225 pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
226 self.message = ::std::option::Option::Some(input);
227 self
228 }
229 /// <p>Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a larger message, provide a message digest.</p>
230 /// <p>If you provide a message digest, use the <code>DIGEST</code> value of <code>MessageType</code> to prevent the digest from being hashed again while signing.</p>
231 pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
232 self.message = input;
233 self
234 }
235 /// <p>Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a larger message, provide a message digest.</p>
236 /// <p>If you provide a message digest, use the <code>DIGEST</code> value of <code>MessageType</code> to prevent the digest from being hashed again while signing.</p>
237 pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
238 &self.message
239 }
240 /// <p>Tells KMS whether the value of the <code>Message</code> parameter should be hashed as part of the signing algorithm. Use <code>RAW</code> for unhashed messages; use <code>DIGEST</code> for message digests, which are already hashed; use <code>EXTERNAL_MU</code> for 64-byte representative μ used in ML-DSA signing as defined in NIST FIPS 204 Section 6.2.</p>
241 /// <p>When the value of <code>MessageType</code> is <code>RAW</code>, KMS uses the standard signing algorithm, which begins with a hash function. When the value is <code>DIGEST</code>, KMS skips the hashing step in the signing algorithm. When the value is <code>EXTERNAL_MU</code> KMS skips the concatenated hashing of the public key hash and the message done in the ML-DSA signing algorithm.</p><important>
242 /// <p>Use the <code>DIGEST</code> or <code>EXTERNAL_MU</code> value only when the value of the <code>Message</code> parameter is a message digest. If you use the <code>DIGEST</code> value with an unhashed message, the security of the signing operation can be compromised.</p>
243 /// </important>
244 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
245 /// <ul>
246 /// <li>
247 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
248 /// <li>
249 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
250 /// </ul><important>
251 /// <p>When you specify the ED25519_PH_SHA_512 signing algorithm with <code>MessageType:DIGEST</code>, KMS still performs the SHA-512 prehash described in <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf#page=39">Step 1 of Section 7.8.1 in FIPS 186-5</a>. This means the input is hashed twice: once by you and once by KMS.</p>
252 /// </important>
253 /// <p>When the value of <code>MessageType</code> is <code>DIGEST</code>, the length of the <code>Message</code> value must match the length of hashed messages for the specified signing algorithm.</p>
254 /// <p>When the value of <code>MessageType</code> is <code>EXTERNAL_MU</code> the length of the <code>Message</code> value must be 64 bytes.</p>
255 /// <p>You can submit a message digest and omit the <code>MessageType</code> or specify <code>RAW</code> so the digest is hashed again while signing. However, this can cause verification failures when verifying with a system that assumes a single hash.</p>
256 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
257 /// <ul>
258 /// <li>
259 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
260 /// <li>
261 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
262 /// <li>
263 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
264 /// <li>
265 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
266 /// <li>
267 /// <p>SM2DSA uses the SM3 hashing algorithm. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/offline-operations.html#key-spec-sm-offline-verification">Offline verification with SM2 key pairs</a>.</p></li>
268 /// </ul>
269 pub fn message_type(mut self, input: crate::types::MessageType) -> Self {
270 self.message_type = ::std::option::Option::Some(input);
271 self
272 }
273 /// <p>Tells KMS whether the value of the <code>Message</code> parameter should be hashed as part of the signing algorithm. Use <code>RAW</code> for unhashed messages; use <code>DIGEST</code> for message digests, which are already hashed; use <code>EXTERNAL_MU</code> for 64-byte representative μ used in ML-DSA signing as defined in NIST FIPS 204 Section 6.2.</p>
274 /// <p>When the value of <code>MessageType</code> is <code>RAW</code>, KMS uses the standard signing algorithm, which begins with a hash function. When the value is <code>DIGEST</code>, KMS skips the hashing step in the signing algorithm. When the value is <code>EXTERNAL_MU</code> KMS skips the concatenated hashing of the public key hash and the message done in the ML-DSA signing algorithm.</p><important>
275 /// <p>Use the <code>DIGEST</code> or <code>EXTERNAL_MU</code> value only when the value of the <code>Message</code> parameter is a message digest. If you use the <code>DIGEST</code> value with an unhashed message, the security of the signing operation can be compromised.</p>
276 /// </important>
277 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
278 /// <ul>
279 /// <li>
280 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
281 /// <li>
282 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
283 /// </ul><important>
284 /// <p>When you specify the ED25519_PH_SHA_512 signing algorithm with <code>MessageType:DIGEST</code>, KMS still performs the SHA-512 prehash described in <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf#page=39">Step 1 of Section 7.8.1 in FIPS 186-5</a>. This means the input is hashed twice: once by you and once by KMS.</p>
285 /// </important>
286 /// <p>When the value of <code>MessageType</code> is <code>DIGEST</code>, the length of the <code>Message</code> value must match the length of hashed messages for the specified signing algorithm.</p>
287 /// <p>When the value of <code>MessageType</code> is <code>EXTERNAL_MU</code> the length of the <code>Message</code> value must be 64 bytes.</p>
288 /// <p>You can submit a message digest and omit the <code>MessageType</code> or specify <code>RAW</code> so the digest is hashed again while signing. However, this can cause verification failures when verifying with a system that assumes a single hash.</p>
289 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
290 /// <ul>
291 /// <li>
292 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
293 /// <li>
294 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
295 /// <li>
296 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
297 /// <li>
298 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
299 /// <li>
300 /// <p>SM2DSA uses the SM3 hashing algorithm. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/offline-operations.html#key-spec-sm-offline-verification">Offline verification with SM2 key pairs</a>.</p></li>
301 /// </ul>
302 pub fn set_message_type(mut self, input: ::std::option::Option<crate::types::MessageType>) -> Self {
303 self.message_type = input;
304 self
305 }
306 /// <p>Tells KMS whether the value of the <code>Message</code> parameter should be hashed as part of the signing algorithm. Use <code>RAW</code> for unhashed messages; use <code>DIGEST</code> for message digests, which are already hashed; use <code>EXTERNAL_MU</code> for 64-byte representative μ used in ML-DSA signing as defined in NIST FIPS 204 Section 6.2.</p>
307 /// <p>When the value of <code>MessageType</code> is <code>RAW</code>, KMS uses the standard signing algorithm, which begins with a hash function. When the value is <code>DIGEST</code>, KMS skips the hashing step in the signing algorithm. When the value is <code>EXTERNAL_MU</code> KMS skips the concatenated hashing of the public key hash and the message done in the ML-DSA signing algorithm.</p><important>
308 /// <p>Use the <code>DIGEST</code> or <code>EXTERNAL_MU</code> value only when the value of the <code>Message</code> parameter is a message digest. If you use the <code>DIGEST</code> value with an unhashed message, the security of the signing operation can be compromised.</p>
309 /// </important>
310 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
311 /// <ul>
312 /// <li>
313 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
314 /// <li>
315 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
316 /// </ul><important>
317 /// <p>When you specify the ED25519_PH_SHA_512 signing algorithm with <code>MessageType:DIGEST</code>, KMS still performs the SHA-512 prehash described in <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf#page=39">Step 1 of Section 7.8.1 in FIPS 186-5</a>. This means the input is hashed twice: once by you and once by KMS.</p>
318 /// </important>
319 /// <p>When the value of <code>MessageType</code> is <code>DIGEST</code>, the length of the <code>Message</code> value must match the length of hashed messages for the specified signing algorithm.</p>
320 /// <p>When the value of <code>MessageType</code> is <code>EXTERNAL_MU</code> the length of the <code>Message</code> value must be 64 bytes.</p>
321 /// <p>You can submit a message digest and omit the <code>MessageType</code> or specify <code>RAW</code> so the digest is hashed again while signing. However, this can cause verification failures when verifying with a system that assumes a single hash.</p>
322 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
323 /// <ul>
324 /// <li>
325 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
326 /// <li>
327 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
328 /// <li>
329 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
330 /// <li>
331 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
332 /// <li>
333 /// <p>SM2DSA uses the SM3 hashing algorithm. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/offline-operations.html#key-spec-sm-offline-verification">Offline verification with SM2 key pairs</a>.</p></li>
334 /// </ul>
335 pub fn get_message_type(&self) -> &::std::option::Option<crate::types::MessageType> {
336 &self.message_type
337 }
338 /// Appends an item to `grant_tokens`.
339 ///
340 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
341 ///
342 /// <p>A list of grant tokens.</p>
343 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
344 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
345 let mut v = self.grant_tokens.unwrap_or_default();
346 v.push(input.into());
347 self.grant_tokens = ::std::option::Option::Some(v);
348 self
349 }
350 /// <p>A list of grant tokens.</p>
351 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
352 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
353 self.grant_tokens = input;
354 self
355 }
356 /// <p>A list of grant tokens.</p>
357 /// <p>Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved <i>eventual consistency</i>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/using-grant-token.html">Using a grant token</a> in the <i>Key Management Service Developer Guide</i>.</p>
358 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
359 &self.grant_tokens
360 }
361 /// <p>Specifies the signing algorithm to use when signing the message.</p>
362 /// <p>Choose an algorithm that is compatible with the type and size of the specified asymmetric KMS key. When signing with RSA key pairs, RSASSA-PSS algorithms are preferred. We include RSASSA-PKCS1-v1_5 algorithms for compatibility with existing applications.</p>
363 /// This field is required.
364 pub fn signing_algorithm(mut self, input: crate::types::SigningAlgorithmSpec) -> Self {
365 self.signing_algorithm = ::std::option::Option::Some(input);
366 self
367 }
368 /// <p>Specifies the signing algorithm to use when signing the message.</p>
369 /// <p>Choose an algorithm that is compatible with the type and size of the specified asymmetric KMS key. When signing with RSA key pairs, RSASSA-PSS algorithms are preferred. We include RSASSA-PKCS1-v1_5 algorithms for compatibility with existing applications.</p>
370 pub fn set_signing_algorithm(mut self, input: ::std::option::Option<crate::types::SigningAlgorithmSpec>) -> Self {
371 self.signing_algorithm = input;
372 self
373 }
374 /// <p>Specifies the signing algorithm to use when signing the message.</p>
375 /// <p>Choose an algorithm that is compatible with the type and size of the specified asymmetric KMS key. When signing with RSA key pairs, RSASSA-PSS algorithms are preferred. We include RSASSA-PKCS1-v1_5 algorithms for compatibility with existing applications.</p>
376 pub fn get_signing_algorithm(&self) -> &::std::option::Option<crate::types::SigningAlgorithmSpec> {
377 &self.signing_algorithm
378 }
379 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
380 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
381 pub fn dry_run(mut self, input: bool) -> Self {
382 self.dry_run = ::std::option::Option::Some(input);
383 self
384 }
385 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
386 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
387 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
388 self.dry_run = input;
389 self
390 }
391 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
392 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/testing-permissions.html">Testing your permissions</a> in the <i>Key Management Service Developer Guide</i>.</p>
393 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
394 &self.dry_run
395 }
396 /// Consumes the builder and constructs a [`SignInput`](crate::operation::sign::SignInput).
397 pub fn build(self) -> ::std::result::Result<crate::operation::sign::SignInput, ::aws_smithy_types::error::operation::BuildError> {
398 ::std::result::Result::Ok(crate::operation::sign::SignInput {
399 key_id: self.key_id,
400 message: self.message,
401 message_type: self.message_type,
402 grant_tokens: self.grant_tokens,
403 signing_algorithm: self.signing_algorithm,
404 dry_run: self.dry_run,
405 })
406 }
407}
408impl ::std::fmt::Debug for SignInputBuilder {
409 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
410 let mut formatter = f.debug_struct("SignInputBuilder");
411 formatter.field("key_id", &self.key_id);
412 formatter.field("message", &"*** Sensitive Data Redacted ***");
413 formatter.field("message_type", &self.message_type);
414 formatter.field("grant_tokens", &self.grant_tokens);
415 formatter.field("signing_algorithm", &self.signing_algorithm);
416 formatter.field("dry_run", &self.dry_run);
417 formatter.finish()
418 }
419}