Skip to content

Commit 77a8792

Browse files
Fix to saved integrity algorithm
1 parent ddf0484 commit 77a8792

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/store/MetaStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private Map<String, AttributeValue> encryptKeys(final String name, final long ve
191191
plaintext.put(ENCRYPTION_ALGORITHM_FIELD, new AttributeValue().withS(encryptionKey.getAlgorithm()));
192192
plaintext
193193
.put(INTEGRITY_KEY_FIELD, new AttributeValue().withB(ByteBuffer.wrap(integrityKey.getEncoded())));
194-
plaintext.put(INTEGRITY_ALGORITHM_FIELD, new AttributeValue().withS(encryptionKey.getAlgorithm()));
194+
plaintext.put(INTEGRITY_ALGORITHM_FIELD, new AttributeValue().withS(integrityKey.getAlgorithm()));
195195

196196
try {
197197
return encryptor.encryptAllFieldsExcept(plaintext, ddbCtx, DEFAULT_HASH_KEY,

src/test/java/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/MostRecentProviderTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public void singleMaterial() throws InterruptedException {
9999

100100
assertEquals(eMat1.getSigningKey(), eMat2.getSigningKey());
101101
assertEquals(eMat1.getSigningKey(), eMat3.getSigningKey());
102+
// Check algorithms. Right now we only support AES and HmacSHA256
103+
assertEquals("AES", eMat1.getEncryptionKey().getAlgorithm());
104+
assertEquals("HmacSHA256", eMat1.getSigningKey().getAlgorithm());
102105

103106
// Ensure we can decrypt all of them without hitting ddb more than the minimum
104107
final MostRecentProvider prov2 = new MostRecentProvider(store, MATERIAL_NAME, 500);

0 commit comments

Comments
 (0)