All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.kms.model.DecryptResponse.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.kms.model



public class DecryptResponse private constructor(builder: Builder) {
    /**
     * The plaintext data encrypted with the public key in the attestation document.
     *
     * This field is included in the response only when the `Recipient` parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see [How Amazon Web Services Nitro Enclaves uses KMS](https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) in the *Key Management Service Developer Guide*.
     */
    public val ciphertextForRecipient: kotlin.ByteArray? = builder.ciphertextForRecipient
    /**
     * The encryption algorithm that was used to decrypt the ciphertext.
     */
    public val encryptionAlgorithm: aws.sdk.kotlin.services.kms.model.EncryptionAlgorithmSpec? = builder.encryptionAlgorithm
    /**
     * The Amazon Resource Name ([key ARN](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) of the KMS key that was used to decrypt the ciphertext.
     */
    public val keyId: kotlin.String? = builder.keyId
    /**
     * Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
     *
     * If the response includes the `CiphertextForRecipient` field, the `Plaintext` field is null or empty.
     */
    public val plaintext: kotlin.ByteArray? = builder.plaintext

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.kms.model.DecryptResponse = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("DecryptResponse(")
        append("ciphertextForRecipient=$ciphertextForRecipient,")
        append("encryptionAlgorithm=$encryptionAlgorithm,")
        append("keyId=$keyId,")
        append("plaintext=*** Sensitive Data Redacted ***")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = ciphertextForRecipient?.contentHashCode() ?: 0
        result = 31 * result + (encryptionAlgorithm?.hashCode() ?: 0)
        result = 31 * result + (keyId?.hashCode() ?: 0)
        result = 31 * result + (plaintext?.contentHashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as DecryptResponse

        if (ciphertextForRecipient != null) {
            if (other.ciphertextForRecipient == null) return false
            if (!ciphertextForRecipient.contentEquals(other.ciphertextForRecipient)) return false
        } else if (other.ciphertextForRecipient != null) return false
        if (encryptionAlgorithm != other.encryptionAlgorithm) return false
        if (keyId != other.keyId) return false
        if (plaintext != null) {
            if (other.plaintext == null) return false
            if (!plaintext.contentEquals(other.plaintext)) return false
        } else if (other.plaintext != null) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.kms.model.DecryptResponse = Builder(this).apply(block).build()

    public class Builder {
        /**
         * The plaintext data encrypted with the public key in the attestation document.
         *
         * This field is included in the response only when the `Recipient` parameter in the request includes a valid attestation document from an Amazon Web Services Nitro enclave. For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see [How Amazon Web Services Nitro Enclaves uses KMS](https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) in the *Key Management Service Developer Guide*.
         */
        public var ciphertextForRecipient: kotlin.ByteArray? = null
        /**
         * The encryption algorithm that was used to decrypt the ciphertext.
         */
        public var encryptionAlgorithm: aws.sdk.kotlin.services.kms.model.EncryptionAlgorithmSpec? = null
        /**
         * The Amazon Resource Name ([key ARN](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) of the KMS key that was used to decrypt the ciphertext.
         */
        public var keyId: kotlin.String? = null
        /**
         * Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
         *
         * If the response includes the `CiphertextForRecipient` field, the `Plaintext` field is null or empty.
         */
        public var plaintext: kotlin.ByteArray? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.kms.model.DecryptResponse) : this() {
            this.ciphertextForRecipient = x.ciphertextForRecipient
            this.encryptionAlgorithm = x.encryptionAlgorithm
            this.keyId = x.keyId
            this.plaintext = x.plaintext
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.kms.model.DecryptResponse = DecryptResponse(this)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy