aws_sdk_paymentcryptographydata/operation/decrypt_data/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::decrypt_data::_decrypt_data_output::DecryptDataOutputBuilder;
3
4pub use crate::operation::decrypt_data::_decrypt_data_input::DecryptDataInputBuilder;
5
6impl crate::operation::decrypt_data::builders::DecryptDataInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::decrypt_data::DecryptDataOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::decrypt_data::DecryptDataError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.decrypt_data();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DecryptData`.
24///
25/// <p>Decrypts ciphertext data to plaintext using a symmetric (TDES, AES), asymmetric (RSA), or derived (DUKPT or EMV) encryption key scheme. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/decrypt-data.html">Decrypt data</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
26/// <p>You can use an decryption key generated within Amazon Web Services Payment Cryptography, or you can import your own decryption key by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a>. For this operation, the key must have <code>KeyModesOfUse</code> set to <code>Decrypt</code>. In asymmetric decryption, Amazon Web Services Payment Cryptography decrypts the ciphertext using the private component of the asymmetric encryption key pair. For data encryption outside of Amazon Web Services Payment Cryptography, you can export the public component of the asymmetric key pair by calling <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetPublicKeyCertificate.html">GetPublicCertificate</a>.</p>
27/// <p>This operation also supports dynamic keys, allowing you to pass a dynamic decryption key as a TR-31 WrappedKeyBlock. This can be used when key material is frequently rotated, such as during every card transaction, and there is need to avoid importing short-lived keys into Amazon Web Services Payment Cryptography. To decrypt using dynamic keys, the <code>keyARN</code> is the Key Encryption Key (KEK) of the TR-31 wrapped decryption key material. The incoming wrapped key shall have a key purpose of D0 with a mode of use of B or D. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/use-cases-acquirers-dynamickeys.html">Using Dynamic Keys</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
28/// <p>For symmetric and DUKPT decryption, Amazon Web Services Payment Cryptography supports <code>TDES</code> and <code>AES</code> algorithms. For EMV decryption, Amazon Web Services Payment Cryptography supports <code>TDES</code> algorithms. For asymmetric decryption, Amazon Web Services Payment Cryptography supports <code>RSA</code>.</p>
29/// <p>When you use TDES or TDES DUKPT, the ciphertext data length must be a multiple of 8 bytes. For AES or AES DUKPT, the ciphertext data length must be a multiple of 16 bytes. For RSA, it sould be equal to the key size unless padding is enabled.</p>
30/// <p>For information about valid keys for this operation, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding key attributes</a> and <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/crypto-ops-validkeys-ops.html">Key types for specific data operations</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p>
31/// <p><b>Cross-account use</b>: This operation can't be used across different Amazon Web Services accounts.</p>
32/// <p><b>Related operations:</b></p>
33/// <ul>
34/// <li>
35/// <p><code>EncryptData</code></p></li>
36/// <li>
37/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetPublicKeyCertificate.html">GetPublicCertificate</a></p></li>
38/// <li>
39/// <p><a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a></p></li>
40/// </ul>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct DecryptDataFluentBuilder {
43    handle: ::std::sync::Arc<crate::client::Handle>,
44    inner: crate::operation::decrypt_data::builders::DecryptDataInputBuilder,
45    config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48    crate::client::customize::internal::CustomizableSend<
49        crate::operation::decrypt_data::DecryptDataOutput,
50        crate::operation::decrypt_data::DecryptDataError,
51    > for DecryptDataFluentBuilder
52{
53    fn send(
54        self,
55        config_override: crate::config::Builder,
56    ) -> crate::client::customize::internal::BoxFuture<
57        crate::client::customize::internal::SendResult<
58            crate::operation::decrypt_data::DecryptDataOutput,
59            crate::operation::decrypt_data::DecryptDataError,
60        >,
61    > {
62        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63    }
64}
65impl DecryptDataFluentBuilder {
66    /// Creates a new `DecryptDataFluentBuilder`.
67    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68        Self {
69            handle,
70            inner: ::std::default::Default::default(),
71            config_override: ::std::option::Option::None,
72        }
73    }
74    /// Access the DecryptData as a reference.
75    pub fn as_input(&self) -> &crate::operation::decrypt_data::builders::DecryptDataInputBuilder {
76        &self.inner
77    }
78    /// Sends the request and returns the response.
79    ///
80    /// If an error occurs, an `SdkError` will be returned with additional details that
81    /// can be matched against.
82    ///
83    /// By default, any retryable failures will be retried twice. Retry behavior
84    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85    /// set when configuring the client.
86    pub async fn send(
87        self,
88    ) -> ::std::result::Result<
89        crate::operation::decrypt_data::DecryptDataOutput,
90        ::aws_smithy_runtime_api::client::result::SdkError<
91            crate::operation::decrypt_data::DecryptDataError,
92            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93        >,
94    > {
95        let input = self
96            .inner
97            .build()
98            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99        let runtime_plugins = crate::operation::decrypt_data::DecryptData::operation_runtime_plugins(
100            self.handle.runtime_plugins.clone(),
101            &self.handle.conf,
102            self.config_override,
103        );
104        crate::operation::decrypt_data::DecryptData::orchestrate(&runtime_plugins, input).await
105    }
106
107    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108    pub fn customize(
109        self,
110    ) -> crate::client::customize::CustomizableOperation<
111        crate::operation::decrypt_data::DecryptDataOutput,
112        crate::operation::decrypt_data::DecryptDataError,
113        Self,
114    > {
115        crate::client::customize::CustomizableOperation::new(self)
116    }
117    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118        self.set_config_override(::std::option::Option::Some(config_override.into()));
119        self
120    }
121
122    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123        self.config_override = config_override;
124        self
125    }
126    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for ciphertext decryption.</p>
127    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
128    pub fn key_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.key_identifier(input.into());
130        self
131    }
132    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for ciphertext decryption.</p>
133    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
134    pub fn set_key_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_key_identifier(input);
136        self
137    }
138    /// <p>The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for ciphertext decryption.</p>
139    /// <p>When a WrappedKeyBlock is provided, this value will be the identifier to the key wrapping key. Otherwise, it is the key identifier used to perform the operation.</p>
140    pub fn get_key_identifier(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_key_identifier()
142    }
143    /// <p>The ciphertext to decrypt.</p>
144    pub fn cipher_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.cipher_text(input.into());
146        self
147    }
148    /// <p>The ciphertext to decrypt.</p>
149    pub fn set_cipher_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_cipher_text(input);
151        self
152    }
153    /// <p>The ciphertext to decrypt.</p>
154    pub fn get_cipher_text(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_cipher_text()
156    }
157    /// <p>The encryption key type and attributes for ciphertext decryption.</p>
158    pub fn decryption_attributes(mut self, input: crate::types::EncryptionDecryptionAttributes) -> Self {
159        self.inner = self.inner.decryption_attributes(input);
160        self
161    }
162    /// <p>The encryption key type and attributes for ciphertext decryption.</p>
163    pub fn set_decryption_attributes(mut self, input: ::std::option::Option<crate::types::EncryptionDecryptionAttributes>) -> Self {
164        self.inner = self.inner.set_decryption_attributes(input);
165        self
166    }
167    /// <p>The encryption key type and attributes for ciphertext decryption.</p>
168    pub fn get_decryption_attributes(&self) -> &::std::option::Option<crate::types::EncryptionDecryptionAttributes> {
169        self.inner.get_decryption_attributes()
170    }
171    /// <p>The WrappedKeyBlock containing the encryption key for ciphertext decryption.</p>
172    pub fn wrapped_key(mut self, input: crate::types::WrappedKey) -> Self {
173        self.inner = self.inner.wrapped_key(input);
174        self
175    }
176    /// <p>The WrappedKeyBlock containing the encryption key for ciphertext decryption.</p>
177    pub fn set_wrapped_key(mut self, input: ::std::option::Option<crate::types::WrappedKey>) -> Self {
178        self.inner = self.inner.set_wrapped_key(input);
179        self
180    }
181    /// <p>The WrappedKeyBlock containing the encryption key for ciphertext decryption.</p>
182    pub fn get_wrapped_key(&self) -> &::std::option::Option<crate::types::WrappedKey> {
183        self.inner.get_wrapped_key()
184    }
185}