public class EncryptRequest extends AmazonWebServiceRequest implements Serializable, Cloneable
Encrypt operation
.
Encrypts plaintext into ciphertext by using a customer master key. The
Encrypt
function has two primary use cases:
Unless you are moving encrypted data from one region to another, you
don't use this function to encrypt a generated data key within a
region. You retrieve data keys already encrypted by calling the
GenerateDataKey or GenerateDataKeyWithoutPlaintext function. Data keys
don't need to be encrypted again by calling Encrypt
.
If you want to encrypt data locally in your application, you can use
the GenerateDataKey
function to return a plaintext data
encryption key and a copy of the key encrypted under the customer
master key (CMK) of your choosing.
NOOP
Constructor and Description |
---|
EncryptRequest() |
Modifier and Type | Method and Description |
---|---|
EncryptRequest |
addEncryptionContextEntry(String key,
String value)
Name/value pair that specifies the encryption context to be used for
authenticated encryption.
|
EncryptRequest |
clearEncryptionContextEntries()
Removes all the entries added into EncryptionContext.
|
EncryptRequest |
clone()
Creates a shallow clone of this request.
|
boolean |
equals(Object obj) |
Map<String,String> |
getEncryptionContext()
Name/value pair that specifies the encryption context to be used for
authenticated encryption.
|
List<String> |
getGrantTokens()
For more information, see Grant
Tokens.
|
String |
getKeyId()
A unique identifier for the customer master key.
|
ByteBuffer |
getPlaintext()
Data to be encrypted.
|
int |
hashCode() |
void |
setEncryptionContext(Map<String,String> encryptionContext)
Name/value pair that specifies the encryption context to be used for
authenticated encryption.
|
void |
setGrantTokens(Collection<String> grantTokens)
For more information, see Grant
Tokens.
|
void |
setKeyId(String keyId)
A unique identifier for the customer master key.
|
void |
setPlaintext(ByteBuffer plaintext)
Data to be encrypted.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
EncryptRequest |
withEncryptionContext(Map<String,String> encryptionContext)
Name/value pair that specifies the encryption context to be used for
authenticated encryption.
|
EncryptRequest |
withGrantTokens(Collection<String> grantTokens)
For more information, see Grant
Tokens.
|
EncryptRequest |
withGrantTokens(String... grantTokens)
For more information, see Grant
Tokens.
|
EncryptRequest |
withKeyId(String keyId)
A unique identifier for the customer master key.
|
EncryptRequest |
withPlaintext(ByteBuffer plaintext)
Data to be encrypted.
|
copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public String getKeyId()
Constraints:
Length: 1 - 256
public void setKeyId(String keyId)
Constraints:
Length: 1 - 256
keyId
- A unique identifier for the customer master key. This value can be a
globally unique identifier, a fully specified ARN to either an alias
or a key, or an alias name prefixed by "alias/". public EncryptRequest withKeyId(String keyId)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 256
keyId
- A unique identifier for the customer master key. This value can be a
globally unique identifier, a fully specified ARN to either an alias
or a key, or an alias name prefixed by "alias/". public ByteBuffer getPlaintext()
Constraints:
Length: 1 - 4096
public void setPlaintext(ByteBuffer plaintext)
Constraints:
Length: 1 - 4096
plaintext
- Data to be encrypted.public EncryptRequest withPlaintext(ByteBuffer plaintext)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 4096
plaintext
- Data to be encrypted.public Map<String,String> getEncryptionContext()
Decrypt
API or decryption will fail. For
more information, see Encryption
Context.Decrypt
API or decryption will fail. For
more information, see Encryption
Context.public void setEncryptionContext(Map<String,String> encryptionContext)
Decrypt
API or decryption will fail. For
more information, see Encryption
Context.encryptionContext
- Name/value pair that specifies the encryption context to be used for
authenticated encryption. If used here, the same value must be
supplied to the Decrypt
API or decryption will fail. For
more information, see Encryption
Context.public EncryptRequest withEncryptionContext(Map<String,String> encryptionContext)
Decrypt
API or decryption will fail. For
more information, see Encryption
Context.
Returns a reference to this object so that method calls can be chained together.
encryptionContext
- Name/value pair that specifies the encryption context to be used for
authenticated encryption. If used here, the same value must be
supplied to the Decrypt
API or decryption will fail. For
more information, see Encryption
Context.public EncryptRequest addEncryptionContextEntry(String key, String value)
Decrypt
API or decryption will fail. For
more information, see Encryption
Context.
The method adds a new key-value pair into EncryptionContext parameter, and returns a reference to this object so that method calls can be chained together.
key
- The key of the entry to be added into EncryptionContext.value
- The corresponding value of the entry to be added into EncryptionContext.public EncryptRequest clearEncryptionContextEntries()
Returns a reference to this object so that method calls can be chained together.
public List<String> getGrantTokens()
Constraints:
Length: 0 - 10
public void setGrantTokens(Collection<String> grantTokens)
Constraints:
Length: 0 - 10
grantTokens
- For more information, see Grant
Tokens.public EncryptRequest withGrantTokens(String... grantTokens)
NOTE: This method appends the values to the existing list (if
any). Use setGrantTokens(java.util.Collection)
or withGrantTokens(java.util.Collection)
if you want to override the
existing values.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 0 - 10
grantTokens
- For more information, see Grant
Tokens.public EncryptRequest withGrantTokens(Collection<String> grantTokens)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 0 - 10
grantTokens
- For more information, see Grant
Tokens.public String toString()
toString
in class Object
Object.toString()
public EncryptRequest clone()
AmazonWebServiceRequest
clone
in class AmazonWebServiceRequest
Object.clone()
Copyright © 2015. All rights reserved.