Skip to main content

aws_sdk_kms/operation/encapsulate/
_encapsulate_output.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 EncapsulateOutput {
6    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
7    pub key_id: ::std::option::Option<::std::string::String>,
8    /// <p>The plaintext shared secret. It is a 32-byte cryptographically random value that both parties can use directly as key material or pass through a key derivation function to generate multiple keys and nonces. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
9    pub shared_secret: ::std::option::Option<::aws_smithy_types::Blob>,
10    /// <p>The encapsulated form of the shared secret. Pass this value to the <code>Decapsulate</code> operation to recover the shared secret. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. The length of <code>SharedSecretCiphertextBlob</code> depends on the ML-KEM key spec. Before Base64 encoding, the encapsulated shared secret is 768 bytes for <code>ML_KEM_512</code>, 1088 bytes for <code>ML_KEM_768</code>, and 1568 bytes for <code>ML_KEM_1024</code>.</p>
11    pub shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
12    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
13    pub encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
14    _request_id: Option<String>,
15}
16impl EncapsulateOutput {
17    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
18    pub fn key_id(&self) -> ::std::option::Option<&str> {
19        self.key_id.as_deref()
20    }
21    /// <p>The plaintext shared secret. It is a 32-byte cryptographically random value that both parties can use directly as key material or pass through a key derivation function to generate multiple keys and nonces. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
22    pub fn shared_secret(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
23        self.shared_secret.as_ref()
24    }
25    /// <p>The encapsulated form of the shared secret. Pass this value to the <code>Decapsulate</code> operation to recover the shared secret. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. The length of <code>SharedSecretCiphertextBlob</code> depends on the ML-KEM key spec. Before Base64 encoding, the encapsulated shared secret is 768 bytes for <code>ML_KEM_512</code>, 1088 bytes for <code>ML_KEM_768</code>, and 1568 bytes for <code>ML_KEM_1024</code>.</p>
26    pub fn shared_secret_ciphertext_blob(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
27        self.shared_secret_ciphertext_blob.as_ref()
28    }
29    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
30    pub fn encapsulation_algorithm(&self) -> ::std::option::Option<&crate::types::EncapsulationAlgorithmSpec> {
31        self.encapsulation_algorithm.as_ref()
32    }
33}
34impl ::std::fmt::Debug for EncapsulateOutput {
35    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
36        let mut formatter = f.debug_struct("EncapsulateOutput");
37        formatter.field("key_id", &self.key_id);
38        formatter.field("shared_secret", &"*** Sensitive Data Redacted ***");
39        formatter.field("shared_secret_ciphertext_blob", &self.shared_secret_ciphertext_blob);
40        formatter.field("encapsulation_algorithm", &self.encapsulation_algorithm);
41        formatter.field("_request_id", &self._request_id);
42        formatter.finish()
43    }
44}
45impl ::aws_types::request_id::RequestId for EncapsulateOutput {
46    fn request_id(&self) -> Option<&str> {
47        self._request_id.as_deref()
48    }
49}
50impl EncapsulateOutput {
51    /// Creates a new builder-style object to manufacture [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
52    pub fn builder() -> crate::operation::encapsulate::builders::EncapsulateOutputBuilder {
53        crate::operation::encapsulate::builders::EncapsulateOutputBuilder::default()
54    }
55}
56
57/// A builder for [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
59#[non_exhaustive]
60pub struct EncapsulateOutputBuilder {
61    pub(crate) key_id: ::std::option::Option<::std::string::String>,
62    pub(crate) shared_secret: ::std::option::Option<::aws_smithy_types::Blob>,
63    pub(crate) shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
64    pub(crate) encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
65    _request_id: Option<String>,
66}
67impl EncapsulateOutputBuilder {
68    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
69    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.key_id = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
74    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.key_id = input;
76        self
77    }
78    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
79    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
80        &self.key_id
81    }
82    /// <p>The plaintext shared secret. It is a 32-byte cryptographically random value that both parties can use directly as key material or pass through a key derivation function to generate multiple keys and nonces. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
83    pub fn shared_secret(mut self, input: ::aws_smithy_types::Blob) -> Self {
84        self.shared_secret = ::std::option::Option::Some(input);
85        self
86    }
87    /// <p>The plaintext shared secret. It is a 32-byte cryptographically random value that both parties can use directly as key material or pass through a key derivation function to generate multiple keys and nonces. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
88    pub fn set_shared_secret(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
89        self.shared_secret = input;
90        self
91    }
92    /// <p>The plaintext shared secret. It is a 32-byte cryptographically random value that both parties can use directly as key material or pass through a key derivation function to generate multiple keys and nonces. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.</p>
93    pub fn get_shared_secret(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
94        &self.shared_secret
95    }
96    /// <p>The encapsulated form of the shared secret. Pass this value to the <code>Decapsulate</code> operation to recover the shared secret. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. The length of <code>SharedSecretCiphertextBlob</code> depends on the ML-KEM key spec. Before Base64 encoding, the encapsulated shared secret is 768 bytes for <code>ML_KEM_512</code>, 1088 bytes for <code>ML_KEM_768</code>, and 1568 bytes for <code>ML_KEM_1024</code>.</p>
97    pub fn shared_secret_ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
98        self.shared_secret_ciphertext_blob = ::std::option::Option::Some(input);
99        self
100    }
101    /// <p>The encapsulated form of the shared secret. Pass this value to the <code>Decapsulate</code> operation to recover the shared secret. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. The length of <code>SharedSecretCiphertextBlob</code> depends on the ML-KEM key spec. Before Base64 encoding, the encapsulated shared secret is 768 bytes for <code>ML_KEM_512</code>, 1088 bytes for <code>ML_KEM_768</code>, and 1568 bytes for <code>ML_KEM_1024</code>.</p>
102    pub fn set_shared_secret_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
103        self.shared_secret_ciphertext_blob = input;
104        self
105    }
106    /// <p>The encapsulated form of the shared secret. Pass this value to the <code>Decapsulate</code> operation to recover the shared secret. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. The length of <code>SharedSecretCiphertextBlob</code> depends on the ML-KEM key spec. Before Base64 encoding, the encapsulated shared secret is 768 bytes for <code>ML_KEM_512</code>, 1088 bytes for <code>ML_KEM_768</code>, and 1568 bytes for <code>ML_KEM_1024</code>.</p>
107    pub fn get_shared_secret_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
108        &self.shared_secret_ciphertext_blob
109    }
110    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
111    pub fn encapsulation_algorithm(mut self, input: crate::types::EncapsulationAlgorithmSpec) -> Self {
112        self.encapsulation_algorithm = ::std::option::Option::Some(input);
113        self
114    }
115    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
116    pub fn set_encapsulation_algorithm(mut self, input: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>) -> Self {
117        self.encapsulation_algorithm = input;
118        self
119    }
120    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
121    pub fn get_encapsulation_algorithm(&self) -> &::std::option::Option<crate::types::EncapsulationAlgorithmSpec> {
122        &self.encapsulation_algorithm
123    }
124    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
125        self._request_id = Some(request_id.into());
126        self
127    }
128
129    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
130        self._request_id = request_id;
131        self
132    }
133    /// Consumes the builder and constructs a [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
134    pub fn build(self) -> crate::operation::encapsulate::EncapsulateOutput {
135        crate::operation::encapsulate::EncapsulateOutput {
136            key_id: self.key_id,
137            shared_secret: self.shared_secret,
138            shared_secret_ciphertext_blob: self.shared_secret_ciphertext_blob,
139            encapsulation_algorithm: self.encapsulation_algorithm,
140            _request_id: self._request_id,
141        }
142    }
143}
144impl ::std::fmt::Debug for EncapsulateOutputBuilder {
145    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
146        let mut formatter = f.debug_struct("EncapsulateOutputBuilder");
147        formatter.field("key_id", &self.key_id);
148        formatter.field("shared_secret", &"*** Sensitive Data Redacted ***");
149        formatter.field("shared_secret_ciphertext_blob", &self.shared_secret_ciphertext_blob);
150        formatter.field("encapsulation_algorithm", &self.encapsulation_algorithm);
151        formatter.field("_request_id", &self._request_id);
152        formatter.finish()
153    }
154}