AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
This is the response object from the Decrypt operation.
Namespace: Amazon.KeyManagementService.Model
Assembly: AWSSDK.KeyManagementService.dll
Version: 3.x.y.z
public class DecryptResponse : AmazonWebServiceResponse
The DecryptResponse type exposes the following members
| Name | Description | |
|---|---|---|
|
DecryptResponse() |
| Name | Type | Description | |
|---|---|---|---|
|
CiphertextForRecipient | System.IO.MemoryStream |
Gets and sets the property CiphertextForRecipient. The plaintext data encrypted with the public key from the attestation document. This ciphertext can be decrypted only by using a private key from the attested environment.
This field is included in the response only when the |
|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
EncryptionAlgorithm | Amazon.KeyManagementService.EncryptionAlgorithmSpec |
Gets and sets the property EncryptionAlgorithm. The encryption algorithm that was used to decrypt the ciphertext. |
|
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
|
KeyId | System.String |
Gets and sets the property KeyId. The Amazon Resource Name (key ARN) of the KMS key that was used to decrypt the ciphertext. |
|
KeyMaterialId | System.String |
Gets and sets the property KeyMaterialId.
The identifier of the key material used to decrypt the ciphertext. This field is present
only when the operation uses a symmetric encryption KMS key. This field is omitted
if the request includes the |
|
Plaintext | System.IO.MemoryStream |
Gets and sets the property Plaintext. 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 |
|
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
The following example decrypts data that was encrypted with an asymmetric encryption KMS key. When the KMS encryption key is asymmetric, you must specify the KMS key ID and the encryption algorithm that was used to encrypt the data.
var client = new AmazonKeyManagementServiceClient();
var response = client.Decrypt(new DecryptRequest
{
CiphertextBlob = new MemoryStream(<binary data>),
EncryptionAlgorithm = "RSAES_OAEP_SHA_256",
KeyId = "0987dcba-09fe-87dc-65ba-ab0987654321"
});
EncryptionAlgorithmSpec encryptionAlgorithm = response.EncryptionAlgorithm;
string keyId = response.KeyId;
MemoryStream plaintext = response.Plaintext;
The following example decrypts data that was encrypted with a symmetric encryption KMS key. The KeyId is not required when decrypting with a symmetric encryption key, but it is a best practice.
var client = new AmazonKeyManagementServiceClient();
var response = client.Decrypt(new DecryptRequest
{
CiphertextBlob = new MemoryStream(<binary data>),
KeyId = "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
});
EncryptionAlgorithmSpec encryptionAlgorithm = response.EncryptionAlgorithm;
string keyId = response.KeyId;
string keyMaterialId = response.KeyMaterialId;
MemoryStream plaintext = response.Plaintext;
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer