aws_sdk_kms/operation/verify/_verify_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 VerifyInput {
6 /// <p>Identifies the asymmetric KMS key that will be used to verify the signature. This must be the same KMS key that was used to generate the signature. If you specify a different KMS key, the signature verification fails.</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 that was signed. You can submit a raw message of up to 4096 bytes, or a hash digest of the message. If you submit a digest, use the <code>MessageType</code> parameter with a value of <code>DIGEST</code>.</p>
22 /// <p>If the message specified here is different from the message that was signed, the signature verification fails. A message and its hash digest are considered to be the same message.</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>
35 /// <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>
36 /// <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>
37 /// <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, if the signed message is hashed once while signing, but twice while verifying, verification fails, even when the message hasn't changed.</p>
38 /// <p>The hashing algorithm that <code>Verify</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
39 /// <ul>
40 /// <li>
41 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
42 /// <li>
43 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
44 /// <li>
45 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
46 /// <li>
47 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
48 /// <li>
49 /// <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>
50 /// </ul>
51 pub message_type: ::std::option::Option<crate::types::MessageType>,
52 /// <p>The signature that the <code>Sign</code> operation generated.</p>
53 pub signature: ::std::option::Option<::aws_smithy_types::Blob>,
54 /// <p>The signing algorithm that was used to sign the message. If you submit a different algorithm, the signature verification fails.</p>
55 pub signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
56 /// <p>A list of grant tokens.</p>
57 /// <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>
58 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
59 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
60 /// <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>
61 pub dry_run: ::std::option::Option<bool>,
62}
63impl VerifyInput {
64 /// <p>Identifies the asymmetric KMS key that will be used to verify the signature. This must be the same KMS key that was used to generate the signature. If you specify a different KMS key, the signature verification fails.</p>
65 /// <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>
66 /// <p>For example:</p>
67 /// <ul>
68 /// <li>
69 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
70 /// <li>
71 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
72 /// <li>
73 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
74 /// <li>
75 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
76 /// </ul>
77 /// <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>
78 pub fn key_id(&self) -> ::std::option::Option<&str> {
79 self.key_id.as_deref()
80 }
81 /// <p>Specifies the message that was signed. You can submit a raw message of up to 4096 bytes, or a hash digest of the message. If you submit a digest, use the <code>MessageType</code> parameter with a value of <code>DIGEST</code>.</p>
82 /// <p>If the message specified here is different from the message that was signed, the signature verification fails. A message and its hash digest are considered to be the same message.</p>
83 pub fn message(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
84 self.message.as_ref()
85 }
86 /// <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>
87 /// <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>
88 /// <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>
89 /// </important>
90 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
91 /// <ul>
92 /// <li>
93 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
94 /// <li>
95 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
96 /// </ul>
97 /// <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>
98 /// <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>
99 /// <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, if the signed message is hashed once while signing, but twice while verifying, verification fails, even when the message hasn't changed.</p>
100 /// <p>The hashing algorithm that <code>Verify</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
101 /// <ul>
102 /// <li>
103 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
104 /// <li>
105 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
106 /// <li>
107 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
108 /// <li>
109 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
110 /// <li>
111 /// <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>
112 /// </ul>
113 pub fn message_type(&self) -> ::std::option::Option<&crate::types::MessageType> {
114 self.message_type.as_ref()
115 }
116 /// <p>The signature that the <code>Sign</code> operation generated.</p>
117 pub fn signature(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
118 self.signature.as_ref()
119 }
120 /// <p>The signing algorithm that was used to sign the message. If you submit a different algorithm, the signature verification fails.</p>
121 pub fn signing_algorithm(&self) -> ::std::option::Option<&crate::types::SigningAlgorithmSpec> {
122 self.signing_algorithm.as_ref()
123 }
124 /// <p>A list of grant tokens.</p>
125 /// <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>
126 ///
127 /// 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()`.
128 pub fn grant_tokens(&self) -> &[::std::string::String] {
129 self.grant_tokens.as_deref().unwrap_or_default()
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 VerifyInput {
138 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
139 let mut formatter = f.debug_struct("VerifyInput");
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("signature", &self.signature);
144 formatter.field("signing_algorithm", &self.signing_algorithm);
145 formatter.field("grant_tokens", &self.grant_tokens);
146 formatter.field("dry_run", &self.dry_run);
147 formatter.finish()
148 }
149}
150impl VerifyInput {
151 /// Creates a new builder-style object to manufacture [`VerifyInput`](crate::operation::verify::VerifyInput).
152 pub fn builder() -> crate::operation::verify::builders::VerifyInputBuilder {
153 crate::operation::verify::builders::VerifyInputBuilder::default()
154 }
155}
156
157/// A builder for [`VerifyInput`](crate::operation::verify::VerifyInput).
158#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
159#[non_exhaustive]
160pub struct VerifyInputBuilder {
161 pub(crate) key_id: ::std::option::Option<::std::string::String>,
162 pub(crate) message: ::std::option::Option<::aws_smithy_types::Blob>,
163 pub(crate) message_type: ::std::option::Option<crate::types::MessageType>,
164 pub(crate) signature: ::std::option::Option<::aws_smithy_types::Blob>,
165 pub(crate) signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
166 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
167 pub(crate) dry_run: ::std::option::Option<bool>,
168}
169impl VerifyInputBuilder {
170 /// <p>Identifies the asymmetric KMS key that will be used to verify the signature. This must be the same KMS key that was used to generate the signature. If you specify a different KMS key, the signature verification fails.</p>
171 /// <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>
172 /// <p>For example:</p>
173 /// <ul>
174 /// <li>
175 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
176 /// <li>
177 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
178 /// <li>
179 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
180 /// <li>
181 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
182 /// </ul>
183 /// <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>
184 /// This field is required.
185 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.key_id = ::std::option::Option::Some(input.into());
187 self
188 }
189 /// <p>Identifies the asymmetric KMS key that will be used to verify the signature. This must be the same KMS key that was used to generate the signature. If you specify a different KMS key, the signature verification fails.</p>
190 /// <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>
191 /// <p>For example:</p>
192 /// <ul>
193 /// <li>
194 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
195 /// <li>
196 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
197 /// <li>
198 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
199 /// <li>
200 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
201 /// </ul>
202 /// <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>
203 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204 self.key_id = input;
205 self
206 }
207 /// <p>Identifies the asymmetric KMS key that will be used to verify the signature. This must be the same KMS key that was used to generate the signature. If you specify a different KMS key, the signature verification fails.</p>
208 /// <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>
209 /// <p>For example:</p>
210 /// <ul>
211 /// <li>
212 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
213 /// <li>
214 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
215 /// <li>
216 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
217 /// <li>
218 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
219 /// </ul>
220 /// <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>
221 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
222 &self.key_id
223 }
224 /// <p>Specifies the message that was signed. You can submit a raw message of up to 4096 bytes, or a hash digest of the message. If you submit a digest, use the <code>MessageType</code> parameter with a value of <code>DIGEST</code>.</p>
225 /// <p>If the message specified here is different from the message that was signed, the signature verification fails. A message and its hash digest are considered to be the same message.</p>
226 /// This field is required.
227 pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
228 self.message = ::std::option::Option::Some(input);
229 self
230 }
231 /// <p>Specifies the message that was signed. You can submit a raw message of up to 4096 bytes, or a hash digest of the message. If you submit a digest, use the <code>MessageType</code> parameter with a value of <code>DIGEST</code>.</p>
232 /// <p>If the message specified here is different from the message that was signed, the signature verification fails. A message and its hash digest are considered to be the same message.</p>
233 pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
234 self.message = input;
235 self
236 }
237 /// <p>Specifies the message that was signed. You can submit a raw message of up to 4096 bytes, or a hash digest of the message. If you submit a digest, use the <code>MessageType</code> parameter with a value of <code>DIGEST</code>.</p>
238 /// <p>If the message specified here is different from the message that was signed, the signature verification fails. A message and its hash digest are considered to be the same message.</p>
239 pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
240 &self.message
241 }
242 /// <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>
243 /// <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>
244 /// <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>
245 /// </important>
246 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
247 /// <ul>
248 /// <li>
249 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
250 /// <li>
251 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
252 /// </ul>
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, if the signed message is hashed once while signing, but twice while verifying, verification fails, even when the message hasn't changed.</p>
256 /// <p>The hashing algorithm that <code>Verify</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>
284 /// <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>
285 /// <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>
286 /// <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, if the signed message is hashed once while signing, but twice while verifying, verification fails, even when the message hasn't changed.</p>
287 /// <p>The hashing algorithm that <code>Verify</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
288 /// <ul>
289 /// <li>
290 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
291 /// <li>
292 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
293 /// <li>
294 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
295 /// <li>
296 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
297 /// <li>
298 /// <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>
299 /// </ul>
300 pub fn set_message_type(mut self, input: ::std::option::Option<crate::types::MessageType>) -> Self {
301 self.message_type = input;
302 self
303 }
304 /// <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>
305 /// <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>
306 /// <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>
307 /// </important>
308 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
309 /// <ul>
310 /// <li>
311 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
312 /// <li>
313 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
314 /// </ul>
315 /// <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>
316 /// <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>
317 /// <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, if the signed message is hashed once while signing, but twice while verifying, verification fails, even when the message hasn't changed.</p>
318 /// <p>The hashing algorithm that <code>Verify</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
319 /// <ul>
320 /// <li>
321 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
322 /// <li>
323 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
324 /// <li>
325 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
326 /// <li>
327 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
328 /// <li>
329 /// <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>
330 /// </ul>
331 pub fn get_message_type(&self) -> &::std::option::Option<crate::types::MessageType> {
332 &self.message_type
333 }
334 /// <p>The signature that the <code>Sign</code> operation generated.</p>
335 /// This field is required.
336 pub fn signature(mut self, input: ::aws_smithy_types::Blob) -> Self {
337 self.signature = ::std::option::Option::Some(input);
338 self
339 }
340 /// <p>The signature that the <code>Sign</code> operation generated.</p>
341 pub fn set_signature(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
342 self.signature = input;
343 self
344 }
345 /// <p>The signature that the <code>Sign</code> operation generated.</p>
346 pub fn get_signature(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
347 &self.signature
348 }
349 /// <p>The signing algorithm that was used to sign the message. If you submit a different algorithm, the signature verification fails.</p>
350 /// This field is required.
351 pub fn signing_algorithm(mut self, input: crate::types::SigningAlgorithmSpec) -> Self {
352 self.signing_algorithm = ::std::option::Option::Some(input);
353 self
354 }
355 /// <p>The signing algorithm that was used to sign the message. If you submit a different algorithm, the signature verification fails.</p>
356 pub fn set_signing_algorithm(mut self, input: ::std::option::Option<crate::types::SigningAlgorithmSpec>) -> Self {
357 self.signing_algorithm = input;
358 self
359 }
360 /// <p>The signing algorithm that was used to sign the message. If you submit a different algorithm, the signature verification fails.</p>
361 pub fn get_signing_algorithm(&self) -> &::std::option::Option<crate::types::SigningAlgorithmSpec> {
362 &self.signing_algorithm
363 }
364 /// Appends an item to `grant_tokens`.
365 ///
366 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
367 ///
368 /// <p>A list of grant tokens.</p>
369 /// <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>
370 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
371 let mut v = self.grant_tokens.unwrap_or_default();
372 v.push(input.into());
373 self.grant_tokens = ::std::option::Option::Some(v);
374 self
375 }
376 /// <p>A list of grant tokens.</p>
377 /// <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>
378 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
379 self.grant_tokens = input;
380 self
381 }
382 /// <p>A list of grant tokens.</p>
383 /// <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>
384 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
385 &self.grant_tokens
386 }
387 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
388 /// <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>
389 pub fn dry_run(mut self, input: bool) -> Self {
390 self.dry_run = ::std::option::Option::Some(input);
391 self
392 }
393 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
394 /// <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>
395 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
396 self.dry_run = input;
397 self
398 }
399 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
400 /// <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>
401 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
402 &self.dry_run
403 }
404 /// Consumes the builder and constructs a [`VerifyInput`](crate::operation::verify::VerifyInput).
405 pub fn build(self) -> ::std::result::Result<crate::operation::verify::VerifyInput, ::aws_smithy_types::error::operation::BuildError> {
406 ::std::result::Result::Ok(crate::operation::verify::VerifyInput {
407 key_id: self.key_id,
408 message: self.message,
409 message_type: self.message_type,
410 signature: self.signature,
411 signing_algorithm: self.signing_algorithm,
412 grant_tokens: self.grant_tokens,
413 dry_run: self.dry_run,
414 })
415 }
416}
417impl ::std::fmt::Debug for VerifyInputBuilder {
418 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
419 let mut formatter = f.debug_struct("VerifyInputBuilder");
420 formatter.field("key_id", &self.key_id);
421 formatter.field("message", &"*** Sensitive Data Redacted ***");
422 formatter.field("message_type", &self.message_type);
423 formatter.field("signature", &self.signature);
424 formatter.field("signing_algorithm", &self.signing_algorithm);
425 formatter.field("grant_tokens", &self.grant_tokens);
426 formatter.field("dry_run", &self.dry_run);
427 formatter.finish()
428 }
429}