/** * <p> * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encdoded. Otherwise, it * is not encoded. * </p> * <p> * The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. * Users of the SDK should not perform Base64 encoding on this field. * </p> * <p> * Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future * major version of the SDK. * </p> * * @param plaintext * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encdoded. * Otherwise, it is not encoded. * @return Returns a reference to this object so that method calls can be chained together. */ public DecryptResult withPlaintext(java.nio.ByteBuffer plaintext) { setPlaintext(plaintext); return this; }
decryptResult.setPlaintext(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context));
public DecryptResult unmarshall(JsonUnmarshallerContext context) throws Exception { DecryptResult decryptResult = new DecryptResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("KeyId")) { decryptResult.setKeyId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Plaintext")) { decryptResult.setPlaintext(ByteBufferJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return decryptResult; }
/** * <p> * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encdoded. Otherwise, it * is not encoded. * </p> * <p> * The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. * Users of the SDK should not perform Base64 encoding on this field. * </p> * <p> * Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future * major version of the SDK. * </p> * * @param plaintext * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encdoded. * Otherwise, it is not encoded. * @return Returns a reference to this object so that method calls can be chained together. */ public DecryptResult withPlaintext(java.nio.ByteBuffer plaintext) { setPlaintext(plaintext); return this; }
/** * <p> * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encoded. Otherwise, it is * not encoded. * </p> * <p> * The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. * Users of the SDK should not perform Base64 encoding on this field. * </p> * <p> * Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future * major version of the SDK. * </p> * * @param plaintext * Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value is Base64-encoded. * Otherwise, it is not encoded. * @return Returns a reference to this object so that method calls can be chained together. */ public DecryptResult withPlaintext(java.nio.ByteBuffer plaintext) { setPlaintext(plaintext); return this; }
@Override public DecryptResult decrypt(AWSKMSClient awsKmsClient, DecryptRequest decryptRequest) { // Check the cipher text. if (decryptRequest.getCiphertextBlob().equals(ByteBuffer.wrap(Base64.decodeBase64(MOCK_CIPHER_TEXT_INVALID)))) { throw new InvalidCiphertextException("(Service: AWSKMS; Status Code: 400; Error Code: InvalidCiphertextException; Request ID: NONE)"); } DecryptResult decryptResult = new DecryptResult(); // Convert the test plain text to byte buffer and set the plain text return value. decryptResult.setPlaintext(ByteBuffer.wrap(MOCK_PLAIN_TEXT.getBytes())); return decryptResult; } }
public DecryptResult unmarshall(JsonUnmarshallerContext context) throws Exception { DecryptResult decryptResult = new DecryptResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("KeyId")) { decryptResult.setKeyId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Plaintext")) { decryptResult.setPlaintext(ByteBufferJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return decryptResult; }
public DecryptResult unmarshall(JsonUnmarshallerContext context) throws Exception { DecryptResult decryptResult = new DecryptResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("KeyId")) { decryptResult.setKeyId(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("Plaintext")) { decryptResult.setPlaintext(ByteBufferJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return decryptResult; }
decryptResult.setPlaintext(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context));
decryptResult.setPlaintext(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context));