public class DynamoDBEncryptor extends java.lang.Object implements ILegacyDynamoDbEncryptor
AttributeEncryptor to perform crypto operations on the record
attributes.
For guidance on performing a safe data model change procedure, please see DynamoDB Encryption Client Developer Guide: Changing your data model
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_SIGNING_ALGORITHM_HEADER |
| Modifier | Constructor and Description |
|---|---|
protected |
DynamoDBEncryptor(EncryptionMaterialsProvider provider,
java.lang.String descriptionBase) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> |
allDecryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Collection<java.lang.String> doNotDecrypt)
Returns the decryption flags for all item attributes except for those explicitly specified to
be excluded.
|
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> |
allDecryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.lang.String... doNotDecrypt)
Returns the decryption flags for all item attributes except for those explicitly specified to
be excluded.
|
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> |
allEncryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Collection<java.lang.String> doNotEncrypt)
Returns the encryption flags for all item attributes except for those explicitly specified to
be excluded.
|
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> |
allEncryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.lang.String... doNotEncrypt)
Returns the encryption flags for all item attributes except for those explicitly specified to
be excluded.
|
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.util.Collection<java.lang.String> doNotDecrypt) |
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.lang.String... doNotDecrypt)
Returns a decrypted version of the provided DynamoDb record.
|
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptRecord(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> attributeActionsOnEncrypt,
EncryptionContext context) |
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.util.Collection<java.lang.String> doNotEncrypt) |
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.lang.String... doNotEncrypt)
Returns an encrypted version of the provided DynamoDb record.
|
java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptRecord(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> attributeActionsOnEncrypt,
EncryptionContext context)
Returns the encrypted (and signed) record, which is a map of item attributes.
|
protected static int |
getBlockSize(java.lang.String encryptionMode) |
java.util.function.Function<EncryptionContext,EncryptionContext> |
getEncryptionContextOverrideOperator() |
static DynamoDBEncryptor |
getInstance(EncryptionMaterialsProvider provider) |
static DynamoDBEncryptor |
getInstance(EncryptionMaterialsProvider provider,
java.lang.String descriptionbase) |
java.lang.String |
getMaterialDescriptionFieldName()
Get the name of the DynamoDB field used to store metadata used by the DynamoDBEncryptedMapper.
|
java.lang.String |
getSignatureFieldName()
Get the name of the DynamoDB field used to store the signature.
|
java.lang.String |
getSigningAlgorithmHeader() |
protected static com.amazonaws.services.dynamodbv2.model.AttributeValue |
marshallDescription(java.util.Map<java.lang.String,java.lang.String> description)
Marshalls the
description into a ByteBuffer by outputting each key (modified
UTF-8) followed by its value (also in modified UTF-8). |
void |
setEncryptionContextOverrideOperator(java.util.function.Function<EncryptionContext,EncryptionContext> encryptionContextOverrideOperator) |
void |
setMaterialDescriptionFieldName(java.lang.String materialDescriptionFieldName)
Set the name of the DynamoDB field used to store metadata used by the DynamoDBEncryptedMapper
|
void |
setSignatureFieldName(java.lang.String signatureFieldName)
Set the name of the DynamoDB field used to store the signature.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
unmarshallDescription(com.amazonaws.services.dynamodbv2.model.AttributeValue attributeValue) |
public static final java.lang.String DEFAULT_SIGNING_ALGORITHM_HEADER
protected DynamoDBEncryptor(EncryptionMaterialsProvider provider, java.lang.String descriptionBase)
public static DynamoDBEncryptor getInstance(EncryptionMaterialsProvider provider, java.lang.String descriptionbase)
public static DynamoDBEncryptor getInstance(EncryptionMaterialsProvider provider)
public java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.lang.String... doNotDecrypt)
throws java.security.GeneralSecurityException
doNotEncrypt are
decrypted.itemAttributes - the DynamoDbRecordcontext - additional information used to successfully select the encryption materials and
decrypt the data. This should include (at least) the tableName and the materialDescription.doNotDecrypt - those fields which should not be encryptedjava.security.SignatureException - if the signature is invalid or cannot be verifiedjava.security.GeneralSecurityExceptionpublic java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.util.Collection<java.lang.String> doNotDecrypt)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptiondecryptAllFieldsExcept(Map, EncryptionContext, String...)public java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> allDecryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, java.lang.String... doNotDecrypt)
doNotDecrypt - fields to be excludedpublic java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> allDecryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, java.util.Collection<java.lang.String> doNotDecrypt)
doNotDecrypt - fields to be excludedpublic java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.lang.String... doNotEncrypt)
throws java.security.GeneralSecurityException
doNotEncrypt) are encrypted.itemAttributes - a DynamoDb Recordcontext - additional information used to successfully select the encryption materials and
encrypt the data. This should include (at least) the tableName.doNotEncrypt - those fields which should not be encryptedjava.security.GeneralSecurityExceptionpublic java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptAllFieldsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
java.util.Collection<java.lang.String> doNotEncrypt)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> allEncryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, java.lang.String... doNotEncrypt)
doNotEncrypt - fields to be excludedpublic java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> allEncryptionFlagsExcept(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, java.util.Collection<java.lang.String> doNotEncrypt)
doNotEncrypt - fields to be excludedpublic java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptRecord(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> attributeActionsOnEncrypt,
EncryptionContext context)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptRecord(java.util.Map<java.lang.String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
java.util.Map<java.lang.String,java.util.Set<EncryptionFlags>> attributeActionsOnEncrypt,
EncryptionContext context)
throws java.security.GeneralSecurityException
itemAttributes - the input recordattributeActionsOnEncrypt - the corresponding encryption flagscontext - encryption contextjava.security.GeneralSecurityException - if failed to encrypt the recordprotected static int getBlockSize(java.lang.String encryptionMode)
public java.lang.String getSignatureFieldName()
DEFAULT_SIGNATURE_FIELD.public void setSignatureFieldName(java.lang.String signatureFieldName)
signatureFieldName - public java.lang.String getMaterialDescriptionFieldName()
DEFAULT_METADATA_FIELD.public void setMaterialDescriptionFieldName(java.lang.String materialDescriptionFieldName)
materialDescriptionFieldName - protected static com.amazonaws.services.dynamodbv2.model.AttributeValue marshallDescription(java.util.Map<java.lang.String,java.lang.String> description)
description into a ByteBuffer by outputting each key (modified
UTF-8) followed by its value (also in modified UTF-8).description - DataOutput.writeUTF(String)public java.lang.String getSigningAlgorithmHeader()
protected static java.util.Map<java.lang.String,java.lang.String> unmarshallDescription(com.amazonaws.services.dynamodbv2.model.AttributeValue attributeValue)
marshallDescription(Map)public final void setEncryptionContextOverrideOperator(java.util.function.Function<EncryptionContext,EncryptionContext> encryptionContextOverrideOperator)
encryptionContextOverrideOperator - the nullable operator which will be used to override
the EncryptionContext.EncryptionContextOperatorspublic final java.util.function.Function<EncryptionContext,EncryptionContext> getEncryptionContextOverrideOperator()
setEncryptionContextOverrideOperator(Function)