public class DynamoDBEncryptor extends Object
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 String |
DEFAULT_SIGNING_ALGORITHM_HEADER |
| Modifier | Constructor and Description |
|---|---|
protected |
DynamoDBEncryptor(EncryptionMaterialsProvider provider,
String descriptionBase) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Set<EncryptionFlags>> |
allDecryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
Collection<String> doNotDecrypt)
Returns the decryption flags for all item attributes except for those explicitly specified to
be excluded.
|
Map<String,Set<EncryptionFlags>> |
allDecryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
String... doNotDecrypt)
Returns the decryption flags for all item attributes except for those explicitly specified to
be excluded.
|
Map<String,Set<EncryptionFlags>> |
allEncryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
Collection<String> doNotEncrypt)
Returns the encryption flags for all item attributes except for those explicitly specified to
be excluded.
|
Map<String,Set<EncryptionFlags>> |
allEncryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
String... doNotEncrypt)
Returns the encryption flags for all item attributes except for those explicitly specified to
be excluded.
|
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
Collection<String> doNotDecrypt) |
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
String... doNotDecrypt)
Returns a decrypted version of the provided DynamoDb record.
|
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
decryptRecord(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
Map<String,Set<EncryptionFlags>> attributeFlags,
EncryptionContext context) |
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
Collection<String> doNotEncrypt) |
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
EncryptionContext context,
String... doNotEncrypt)
Returns an encrypted version of the provided DynamoDb record.
|
Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> |
encryptRecord(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes,
Map<String,Set<EncryptionFlags>> attributeFlags,
EncryptionContext context)
Returns the encrypted (and signed) record, which is a map of item attributes.
|
protected static int |
getBlockSize(String encryptionMode) |
Function<EncryptionContext,EncryptionContext> |
getEncryptionContextOverrideOperator() |
static DynamoDBEncryptor |
getInstance(EncryptionMaterialsProvider provider) |
static DynamoDBEncryptor |
getInstance(EncryptionMaterialsProvider provider,
String descriptionbase) |
String |
getMaterialDescriptionFieldName()
Get the name of the DynamoDB field used to store metadata used by the DynamoDBEncryptedMapper.
|
String |
getSignatureFieldName()
Get the name of the DynamoDB field used to store the signature.
|
String |
getSigningAlgorithmHeader() |
protected static com.amazonaws.services.dynamodbv2.model.AttributeValue |
marshallDescription(Map<String,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(Function<EncryptionContext,EncryptionContext> encryptionContextOverrideOperator) |
void |
setMaterialDescriptionFieldName(String materialDescriptionFieldName)
Set the name of the DynamoDB field used to store metadata used by the DynamoDBEncryptedMapper
|
void |
setSignatureFieldName(String signatureFieldName)
Set the name of the DynamoDB field used to store the signature.
|
protected static Map<String,String> |
unmarshallDescription(com.amazonaws.services.dynamodbv2.model.AttributeValue attributeValue) |
public static final String DEFAULT_SIGNING_ALGORITHM_HEADER
protected DynamoDBEncryptor(EncryptionMaterialsProvider provider, String descriptionBase)
public static DynamoDBEncryptor getInstance(EncryptionMaterialsProvider provider, String descriptionbase)
public static DynamoDBEncryptor getInstance(EncryptionMaterialsProvider provider)
public Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, EncryptionContext context, String... doNotDecrypt) throws 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 encryptedSignatureException - if the signature is invalid or cannot be verifiedGeneralSecurityExceptionpublic Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, EncryptionContext context, Collection<String> doNotDecrypt) throws GeneralSecurityException
public Map<String,Set<EncryptionFlags>> allDecryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, String... doNotDecrypt)
doNotDecrypt - fields to be excludedpublic Map<String,Set<EncryptionFlags>> allDecryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, Collection<String> doNotDecrypt)
doNotDecrypt - fields to be excludedpublic Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, EncryptionContext context, String... doNotEncrypt) throws 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 encryptedGeneralSecurityExceptionpublic Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptAllFieldsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, EncryptionContext context, Collection<String> doNotEncrypt) throws GeneralSecurityException
GeneralSecurityExceptionpublic Map<String,Set<EncryptionFlags>> allEncryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, String... doNotEncrypt)
doNotEncrypt - fields to be excludedpublic Map<String,Set<EncryptionFlags>> allEncryptionFlagsExcept(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, Collection<String> doNotEncrypt)
doNotEncrypt - fields to be excludedpublic Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> decryptRecord(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, Map<String,Set<EncryptionFlags>> attributeFlags, EncryptionContext context) throws GeneralSecurityException
GeneralSecurityExceptionpublic Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> encryptRecord(Map<String,com.amazonaws.services.dynamodbv2.model.AttributeValue> itemAttributes, Map<String,Set<EncryptionFlags>> attributeFlags, EncryptionContext context) throws GeneralSecurityException
itemAttributes - the input recordattributeFlags - the corresponding encryption flagscontext - encryption contextGeneralSecurityException - if failed to encrypt the recordprotected static int getBlockSize(String encryptionMode)
public String getSignatureFieldName()
DEFAULT_SIGNATURE_FIELD.public void setSignatureFieldName(String signatureFieldName)
signatureFieldName - public String getMaterialDescriptionFieldName()
DEFAULT_METADATA_FIELD.public void setMaterialDescriptionFieldName(String materialDescriptionFieldName)
materialDescriptionFieldName - protected static com.amazonaws.services.dynamodbv2.model.AttributeValue marshallDescription(Map<String,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 String getSigningAlgorithmHeader()
protected static Map<String,String> unmarshallDescription(com.amazonaws.services.dynamodbv2.model.AttributeValue attributeValue)
marshallDescription(Map)public final void setEncryptionContextOverrideOperator(Function<EncryptionContext,EncryptionContext> encryptionContextOverrideOperator)
encryptionContextOverrideOperator - the nullable operator which will be used to override
the EncryptionContext.EncryptionContextOperatorspublic final Function<EncryptionContext,EncryptionContext> getEncryptionContextOverrideOperator()
setEncryptionContextOverrideOperator(Function)Copyright © 2021. All rights reserved.