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>
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, this can cause verification failures when verifying with a system that assumes a single hash.</p>
38 /// <p>The hashing algorithm that <code>Sign</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>A list of grant tokens.</p>
53 /// <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>
54 pub grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
55 /// <p>Specifies the signing algorithm to use when signing the message.</p>
56 /// <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>
57 pub signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
58 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
59 /// <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>
60 pub dry_run: ::std::option::Option<bool>,
61}
62impl SignInput {
63 /// <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>
64 /// <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>
65 /// <p>For example:</p>
66 /// <ul>
67 /// <li>
68 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
69 /// <li>
70 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
71 /// <li>
72 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
73 /// <li>
74 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
75 /// </ul>
76 /// <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>
77 pub fn key_id(&self) -> ::std::option::Option<&str> {
78 self.key_id.as_deref()
79 }
80 /// <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>
81 /// <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>
82 pub fn message(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
83 self.message.as_ref()
84 }
85 /// <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>
86 /// <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>
87 /// <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>
88 /// </important>
89 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
90 /// <ul>
91 /// <li>
92 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
93 /// <li>
94 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
95 /// </ul>
96 /// <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>
97 /// <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>
98 /// <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>
99 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
100 /// <ul>
101 /// <li>
102 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
103 /// <li>
104 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
105 /// <li>
106 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
107 /// <li>
108 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
109 /// <li>
110 /// <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>
111 /// </ul>
112 pub fn message_type(&self) -> ::std::option::Option<&crate::types::MessageType> {
113 self.message_type.as_ref()
114 }
115 /// <p>A list of grant tokens.</p>
116 /// <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>
117 ///
118 /// 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()`.
119 pub fn grant_tokens(&self) -> &[::std::string::String] {
120 self.grant_tokens.as_deref().unwrap_or_default()
121 }
122 /// <p>Specifies the signing algorithm to use when signing the message.</p>
123 /// <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>
124 pub fn signing_algorithm(&self) -> ::std::option::Option<&crate::types::SigningAlgorithmSpec> {
125 self.signing_algorithm.as_ref()
126 }
127 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
128 /// <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>
129 pub fn dry_run(&self) -> ::std::option::Option<bool> {
130 self.dry_run
131 }
132}
133impl ::std::fmt::Debug for SignInput {
134 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
135 let mut formatter = f.debug_struct("SignInput");
136 formatter.field("key_id", &self.key_id);
137 formatter.field("message", &"*** Sensitive Data Redacted ***");
138 formatter.field("message_type", &self.message_type);
139 formatter.field("grant_tokens", &self.grant_tokens);
140 formatter.field("signing_algorithm", &self.signing_algorithm);
141 formatter.field("dry_run", &self.dry_run);
142 formatter.finish()
143 }
144}
145impl SignInput {
146 /// Creates a new builder-style object to manufacture [`SignInput`](crate::operation::sign::SignInput).
147 pub fn builder() -> crate::operation::sign::builders::SignInputBuilder {
148 crate::operation::sign::builders::SignInputBuilder::default()
149 }
150}
151
152/// A builder for [`SignInput`](crate::operation::sign::SignInput).
153#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
154#[non_exhaustive]
155pub struct SignInputBuilder {
156 pub(crate) key_id: ::std::option::Option<::std::string::String>,
157 pub(crate) message: ::std::option::Option<::aws_smithy_types::Blob>,
158 pub(crate) message_type: ::std::option::Option<crate::types::MessageType>,
159 pub(crate) grant_tokens: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
160 pub(crate) signing_algorithm: ::std::option::Option<crate::types::SigningAlgorithmSpec>,
161 pub(crate) dry_run: ::std::option::Option<bool>,
162}
163impl SignInputBuilder {
164 /// <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>
165 /// <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>
166 /// <p>For example:</p>
167 /// <ul>
168 /// <li>
169 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
170 /// <li>
171 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
172 /// <li>
173 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
174 /// <li>
175 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
176 /// </ul>
177 /// <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>
178 /// This field is required.
179 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180 self.key_id = ::std::option::Option::Some(input.into());
181 self
182 }
183 /// <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>
184 /// <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>
185 /// <p>For example:</p>
186 /// <ul>
187 /// <li>
188 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
189 /// <li>
190 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
191 /// <li>
192 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
193 /// <li>
194 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
195 /// </ul>
196 /// <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>
197 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198 self.key_id = input;
199 self
200 }
201 /// <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>
202 /// <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>
203 /// <p>For example:</p>
204 /// <ul>
205 /// <li>
206 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
207 /// <li>
208 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
209 /// <li>
210 /// <p>Alias name: <code>alias/ExampleAlias</code></p></li>
211 /// <li>
212 /// <p>Alias ARN: <code>arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias</code></p></li>
213 /// </ul>
214 /// <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>
215 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
216 &self.key_id
217 }
218 /// <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>
219 /// <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>
220 /// This field is required.
221 pub fn message(mut self, input: ::aws_smithy_types::Blob) -> Self {
222 self.message = ::std::option::Option::Some(input);
223 self
224 }
225 /// <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>
226 /// <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>
227 pub fn set_message(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
228 self.message = input;
229 self
230 }
231 /// <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>
232 /// <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>
233 pub fn get_message(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
234 &self.message
235 }
236 /// <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>
237 /// <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>
238 /// <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>
239 /// </important>
240 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
241 /// <ul>
242 /// <li>
243 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
244 /// <li>
245 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
246 /// </ul>
247 /// <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>
248 /// <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>
249 /// <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>
250 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
251 /// <ul>
252 /// <li>
253 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
254 /// <li>
255 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
256 /// <li>
257 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
258 /// <li>
259 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
260 /// <li>
261 /// <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>
262 /// </ul>
263 pub fn message_type(mut self, input: crate::types::MessageType) -> Self {
264 self.message_type = ::std::option::Option::Some(input);
265 self
266 }
267 /// <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>
268 /// <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>
269 /// <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>
270 /// </important>
271 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
272 /// <ul>
273 /// <li>
274 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
275 /// <li>
276 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
277 /// </ul>
278 /// <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>
279 /// <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>
280 /// <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>
281 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
282 /// <ul>
283 /// <li>
284 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
285 /// <li>
286 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
287 /// <li>
288 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
289 /// <li>
290 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
291 /// <li>
292 /// <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>
293 /// </ul>
294 pub fn set_message_type(mut self, input: ::std::option::Option<crate::types::MessageType>) -> Self {
295 self.message_type = input;
296 self
297 }
298 /// <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>
299 /// <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>
300 /// <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>
301 /// </important>
302 /// <p>When using ECC_NIST_EDWARDS25519 KMS keys:</p>
303 /// <ul>
304 /// <li>
305 /// <p>ED25519_SHA_512 signing algorithm requires KMS <code>MessageType:RAW</code></p></li>
306 /// <li>
307 /// <p>ED25519_PH_SHA_512 signing algorithm requires KMS <code>MessageType:DIGEST</code></p></li>
308 /// </ul>
309 /// <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>
310 /// <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>
311 /// <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>
312 /// <p>The hashing algorithm that <code>Sign</code> uses is based on the <code>SigningAlgorithm</code> value.</p>
313 /// <ul>
314 /// <li>
315 /// <p>Signing algorithms that end in SHA_256 use the SHA_256 hashing algorithm.</p></li>
316 /// <li>
317 /// <p>Signing algorithms that end in SHA_384 use the SHA_384 hashing algorithm.</p></li>
318 /// <li>
319 /// <p>Signing algorithms that end in SHA_512 use the SHA_512 hashing algorithm.</p></li>
320 /// <li>
321 /// <p>Signing algorithms that end in SHAKE_256 use the SHAKE_256 hashing algorithm.</p></li>
322 /// <li>
323 /// <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>
324 /// </ul>
325 pub fn get_message_type(&self) -> &::std::option::Option<crate::types::MessageType> {
326 &self.message_type
327 }
328 /// Appends an item to `grant_tokens`.
329 ///
330 /// To override the contents of this collection use [`set_grant_tokens`](Self::set_grant_tokens).
331 ///
332 /// <p>A list of grant tokens.</p>
333 /// <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>
334 pub fn grant_tokens(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
335 let mut v = self.grant_tokens.unwrap_or_default();
336 v.push(input.into());
337 self.grant_tokens = ::std::option::Option::Some(v);
338 self
339 }
340 /// <p>A list of grant tokens.</p>
341 /// <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>
342 pub fn set_grant_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
343 self.grant_tokens = input;
344 self
345 }
346 /// <p>A list of grant tokens.</p>
347 /// <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>
348 pub fn get_grant_tokens(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
349 &self.grant_tokens
350 }
351 /// <p>Specifies the signing algorithm to use when signing the message.</p>
352 /// <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>
353 /// This field is required.
354 pub fn signing_algorithm(mut self, input: crate::types::SigningAlgorithmSpec) -> Self {
355 self.signing_algorithm = ::std::option::Option::Some(input);
356 self
357 }
358 /// <p>Specifies the signing algorithm to use when signing the message.</p>
359 /// <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>
360 pub fn set_signing_algorithm(mut self, input: ::std::option::Option<crate::types::SigningAlgorithmSpec>) -> Self {
361 self.signing_algorithm = input;
362 self
363 }
364 /// <p>Specifies the signing algorithm to use when signing the message.</p>
365 /// <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>
366 pub fn get_signing_algorithm(&self) -> &::std::option::Option<crate::types::SigningAlgorithmSpec> {
367 &self.signing_algorithm
368 }
369 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
370 /// <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>
371 pub fn dry_run(mut self, input: bool) -> Self {
372 self.dry_run = ::std::option::Option::Some(input);
373 self
374 }
375 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
376 /// <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>
377 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
378 self.dry_run = input;
379 self
380 }
381 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
382 /// <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>
383 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
384 &self.dry_run
385 }
386 /// Consumes the builder and constructs a [`SignInput`](crate::operation::sign::SignInput).
387 pub fn build(self) -> ::std::result::Result<crate::operation::sign::SignInput, ::aws_smithy_types::error::operation::BuildError> {
388 ::std::result::Result::Ok(crate::operation::sign::SignInput {
389 key_id: self.key_id,
390 message: self.message,
391 message_type: self.message_type,
392 grant_tokens: self.grant_tokens,
393 signing_algorithm: self.signing_algorithm,
394 dry_run: self.dry_run,
395 })
396 }
397}
398impl ::std::fmt::Debug for SignInputBuilder {
399 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
400 let mut formatter = f.debug_struct("SignInputBuilder");
401 formatter.field("key_id", &self.key_id);
402 formatter.field("message", &"*** Sensitive Data Redacted ***");
403 formatter.field("message_type", &self.message_type);
404 formatter.field("grant_tokens", &self.grant_tokens);
405 formatter.field("signing_algorithm", &self.signing_algorithm);
406 formatter.field("dry_run", &self.dry_run);
407 formatter.finish()
408 }
409}