aws-sdk-kms 1.127.0

AWS SDK for AWS Key Management Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct EncapsulateOutput {
    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
    pub key_id: ::std::option::Option<::std::string::String>,
    /// <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>
    pub shared_secret: ::std::option::Option<::aws_smithy_types::Blob>,
    /// <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>
    pub shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
    pub encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
    _request_id: Option<String>,
}
impl EncapsulateOutput {
    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
    pub fn key_id(&self) -> ::std::option::Option<&str> {
        self.key_id.as_deref()
    }
    /// <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>
    pub fn shared_secret(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
        self.shared_secret.as_ref()
    }
    /// <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>
    pub fn shared_secret_ciphertext_blob(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
        self.shared_secret_ciphertext_blob.as_ref()
    }
    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
    pub fn encapsulation_algorithm(&self) -> ::std::option::Option<&crate::types::EncapsulationAlgorithmSpec> {
        self.encapsulation_algorithm.as_ref()
    }
}
impl ::std::fmt::Debug for EncapsulateOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("EncapsulateOutput");
        formatter.field("key_id", &self.key_id);
        formatter.field("shared_secret", &"*** Sensitive Data Redacted ***");
        formatter.field("shared_secret_ciphertext_blob", &self.shared_secret_ciphertext_blob);
        formatter.field("encapsulation_algorithm", &self.encapsulation_algorithm);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
impl ::aws_types::request_id::RequestId for EncapsulateOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl EncapsulateOutput {
    /// Creates a new builder-style object to manufacture [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
    pub fn builder() -> crate::operation::encapsulate::builders::EncapsulateOutputBuilder {
        crate::operation::encapsulate::builders::EncapsulateOutputBuilder::default()
    }
}

/// A builder for [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct EncapsulateOutputBuilder {
    pub(crate) key_id: ::std::option::Option<::std::string::String>,
    pub(crate) shared_secret: ::std::option::Option<::aws_smithy_types::Blob>,
    pub(crate) shared_secret_ciphertext_blob: ::std::option::Option<::aws_smithy_types::Blob>,
    pub(crate) encapsulation_algorithm: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>,
    _request_id: Option<String>,
}
impl EncapsulateOutputBuilder {
    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_id = input;
        self
    }
    /// <p>The identifier of the ML-KEM KMS key used to encapsulate the shared secret.</p>
    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_id
    }
    /// <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>
    pub fn shared_secret(mut self, input: ::aws_smithy_types::Blob) -> Self {
        self.shared_secret = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_shared_secret(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
        self.shared_secret = input;
        self
    }
    /// <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>
    pub fn get_shared_secret(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
        &self.shared_secret
    }
    /// <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>
    pub fn shared_secret_ciphertext_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
        self.shared_secret_ciphertext_blob = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_shared_secret_ciphertext_blob(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
        self.shared_secret_ciphertext_blob = input;
        self
    }
    /// <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>
    pub fn get_shared_secret_ciphertext_blob(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
        &self.shared_secret_ciphertext_blob
    }
    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
    pub fn encapsulation_algorithm(mut self, input: crate::types::EncapsulationAlgorithmSpec) -> Self {
        self.encapsulation_algorithm = ::std::option::Option::Some(input);
        self
    }
    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
    pub fn set_encapsulation_algorithm(mut self, input: ::std::option::Option<crate::types::EncapsulationAlgorithmSpec>) -> Self {
        self.encapsulation_algorithm = input;
        self
    }
    /// <p>The key encapsulation algorithm used to generate the shared secret.</p>
    pub fn get_encapsulation_algorithm(&self) -> &::std::option::Option<crate::types::EncapsulationAlgorithmSpec> {
        &self.encapsulation_algorithm
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`EncapsulateOutput`](crate::operation::encapsulate::EncapsulateOutput).
    pub fn build(self) -> crate::operation::encapsulate::EncapsulateOutput {
        crate::operation::encapsulate::EncapsulateOutput {
            key_id: self.key_id,
            shared_secret: self.shared_secret,
            shared_secret_ciphertext_blob: self.shared_secret_ciphertext_blob,
            encapsulation_algorithm: self.encapsulation_algorithm,
            _request_id: self._request_id,
        }
    }
}
impl ::std::fmt::Debug for EncapsulateOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("EncapsulateOutputBuilder");
        formatter.field("key_id", &self.key_id);
        formatter.field("shared_secret", &"*** Sensitive Data Redacted ***");
        formatter.field("shared_secret_ciphertext_blob", &self.shared_secret_ciphertext_blob);
        formatter.field("encapsulation_algorithm", &self.encapsulation_algorithm);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}