Skip to content

Commit 156e801

Browse files
authored
chore: bump version for release 1.15.2 (#224)
1 parent af496ed commit 156e801

File tree

140 files changed

+20588
-20100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+20588
-20100
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Changelog
2+
## 1.15.2 -- 2022-01-06
3+
4+
### Maintenance
5+
* Upgrade AWS SDK
6+
* Upgrade build dependencies
7+
28
## 1.15.1 -- 2021-02-12
39
Fixes released jar files to ensure JDK 8 compatibility.
410

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ You can download the [latest snapshot release][download] or pick it up from Mave
119119
<dependency>
120120
<groupId>com.amazonaws</groupId>
121121
<artifactId>aws-dynamodb-encryption-java</artifactId>
122-
<version>1.15.1</version>
122+
<version>1.15.2</version>
123123
</dependency>
124124
```
125125

examples/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
<parent>
99
<groupId>software.amazon.cryptools</groupId>
1010
<artifactId>dynamodbencryptionclient-pom</artifactId>
11-
<version>1.15.1</version>
11+
<version>1.15.2</version>
1212
</parent>
1313

1414
<artifactId>dynamodbencryptionclient-sdk1examples</artifactId>
1515
<packaging>jar</packaging>
16-
<version>1.15.1</version>
16+
<version>1.15.2</version>
1717
<name>aws-dynamodb-encryption-java :: SDK1 Examples</name>
1818
<description>Examples for AWS DynamoDB Encryption Client for AWS Java SDK v1</description>
1919

@@ -27,7 +27,7 @@
2727
<dependency>
2828
<groupId>com.amazonaws</groupId>
2929
<artifactId>aws-dynamodb-encryption-java</artifactId>
30-
<version>1.15.1</version>
30+
<version>1.15.2</version>
3131
</dependency>
3232

3333
<dependency>

examples/src/main/java/com/amazonaws/examples/AsymmetricEncryptedItem.java

+56-28
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
*/
1515
package com.amazonaws.examples;
1616

17+
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.DynamoDBEncryptor;
18+
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionContext;
19+
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionFlags;
20+
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.providers.WrappedMaterialsProvider;
21+
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
1722
import java.nio.ByteBuffer;
1823
import java.security.GeneralSecurityException;
1924
import java.security.KeyPair;
@@ -23,15 +28,9 @@
2328
import java.util.Map;
2429
import java.util.Set;
2530

26-
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.DynamoDBEncryptor;
27-
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionContext;
28-
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionFlags;
29-
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.providers.WrappedMaterialsProvider;
30-
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
31-
3231
/**
33-
* Example showing use of RSA keys for encryption and signing.
34-
* For ease of the example, we create new random ones every time.
32+
* Example showing use of RSA keys for encryption and signing. For ease of the example, we create
33+
* new random ones every time.
3534
*/
3635
public class AsymmetricEncryptedItem {
3736
private static final String STRING_FIELD_NAME = "example";
@@ -50,7 +49,8 @@ public static void main(String[] args) throws GeneralSecurityException {
5049
encryptRecord(tableName, wrappingKeys, signingKeys);
5150
}
5251

53-
public static void encryptRecord(String tableName, KeyPair wrappingKeys, KeyPair signingKeys) throws GeneralSecurityException {
52+
public static void encryptRecord(String tableName, KeyPair wrappingKeys, KeyPair signingKeys)
53+
throws GeneralSecurityException {
5454
// Sample record to be encrypted
5555
final String partitionKeyName = "partition_attribute";
5656
final String sortKeyName = "sort_attribute";
@@ -59,25 +59,34 @@ public static void encryptRecord(String tableName, KeyPair wrappingKeys, KeyPair
5959
record.put(sortKeyName, new AttributeValue().withN("55"));
6060
record.put(STRING_FIELD_NAME, new AttributeValue().withS("data"));
6161
record.put(NUMBER_FIELD_NAME, new AttributeValue().withN("99"));
62-
record.put(BINARY_FIELD_NAME, new AttributeValue().withB(ByteBuffer.wrap(new byte[]{0x00, 0x01, 0x02})));
63-
record.put(IGNORED_FIELD_NAME, new AttributeValue().withS("alone")); // We want to ignore this attribute
62+
record.put(
63+
BINARY_FIELD_NAME,
64+
new AttributeValue().withB(ByteBuffer.wrap(new byte[] {0x00, 0x01, 0x02})));
65+
record.put(
66+
IGNORED_FIELD_NAME,
67+
new AttributeValue().withS("alone")); // We want to ignore this attribute
6468

65-
// Set up our configuration and clients. All of this is thread-safe and can be reused across calls.
69+
// Set up our configuration and clients. All of this is thread-safe and can be reused across
70+
// calls.
6671
// Provider Configuration
67-
final WrappedMaterialsProvider cmp = new WrappedMaterialsProvider(wrappingKeys.getPublic(), wrappingKeys.getPrivate(), signingKeys);
72+
final WrappedMaterialsProvider cmp =
73+
new WrappedMaterialsProvider(
74+
wrappingKeys.getPublic(), wrappingKeys.getPrivate(), signingKeys);
6875
// Encryptor creation
6976
final DynamoDBEncryptor encryptor = DynamoDBEncryptor.getInstance(cmp);
7077

7178
// Information about the context of our data (normally just Table information)
72-
final EncryptionContext encryptionContext = new EncryptionContext.Builder()
73-
.withTableName(tableName)
74-
.withHashKeyName(partitionKeyName)
75-
.withRangeKeyName(sortKeyName)
76-
.build();
79+
final EncryptionContext encryptionContext =
80+
new EncryptionContext.Builder()
81+
.withTableName(tableName)
82+
.withHashKeyName(partitionKeyName)
83+
.withRangeKeyName(sortKeyName)
84+
.build();
7785

7886
// Describe what actions need to be taken for each attribute
7987
final EnumSet<EncryptionFlags> signOnly = EnumSet.of(EncryptionFlags.SIGN);
80-
final EnumSet<EncryptionFlags> encryptAndSign = EnumSet.of(EncryptionFlags.ENCRYPT, EncryptionFlags.SIGN);
88+
final EnumSet<EncryptionFlags> encryptAndSign =
89+
EnumSet.of(EncryptionFlags.ENCRYPT, EncryptionFlags.SIGN);
8190
final Map<String, Set<EncryptionFlags>> actions = new HashMap<>();
8291
for (final String attributeName : record.keySet()) {
8392
switch (attributeName) {
@@ -98,13 +107,22 @@ public static void encryptRecord(String tableName, KeyPair wrappingKeys, KeyPair
98107
// End set-up
99108

100109
// Encrypt the plaintext record directly
101-
final Map<String, AttributeValue> encrypted_record = encryptor.encryptRecord(record, actions, encryptionContext);
110+
final Map<String, AttributeValue> encrypted_record =
111+
encryptor.encryptRecord(record, actions, encryptionContext);
102112

103113
// Encrypted record fields change as expected
104-
assert encrypted_record.get(STRING_FIELD_NAME).getB() != null; // the encrypted string is stored as bytes
105-
assert encrypted_record.get(NUMBER_FIELD_NAME).getB() != null; // the encrypted number is stored as bytes
106-
assert !record.get(BINARY_FIELD_NAME).getB().equals(encrypted_record.get(BINARY_FIELD_NAME).getB()); // the encrypted bytes have updated
107-
assert record.get(IGNORED_FIELD_NAME).getS().equals(encrypted_record.get(IGNORED_FIELD_NAME).getS()); // ignored field is left as is
114+
assert encrypted_record.get(STRING_FIELD_NAME).getB()
115+
!= null; // the encrypted string is stored as bytes
116+
assert encrypted_record.get(NUMBER_FIELD_NAME).getB()
117+
!= null; // the encrypted number is stored as bytes
118+
assert !record
119+
.get(BINARY_FIELD_NAME)
120+
.getB()
121+
.equals(encrypted_record.get(BINARY_FIELD_NAME).getB()); // the encrypted bytes have updated
122+
assert record
123+
.get(IGNORED_FIELD_NAME)
124+
.getS()
125+
.equals(encrypted_record.get(IGNORED_FIELD_NAME).getS()); // ignored field is left as is
108126

109127
// We could now put the encrypted item to DynamoDB just as we would any other item.
110128
// We're skipping it to to keep the example simpler.
@@ -113,12 +131,22 @@ public static void encryptRecord(String tableName, KeyPair wrappingKeys, KeyPair
113131
System.out.println("Encrypted Record: " + encrypted_record);
114132

115133
// Decryption is identical. We'll pretend that we retrieved the record from DynamoDB.
116-
final Map<String, AttributeValue> decrypted_record = encryptor.decryptRecord(encrypted_record, actions, encryptionContext);
134+
final Map<String, AttributeValue> decrypted_record =
135+
encryptor.decryptRecord(encrypted_record, actions, encryptionContext);
117136
System.out.println("Decrypted Record: " + decrypted_record);
118137

119138
// The decrypted fields match the original fields before encryption
120-
assert record.get(STRING_FIELD_NAME).getS().equals(decrypted_record.get(STRING_FIELD_NAME).getS());
121-
assert record.get(NUMBER_FIELD_NAME).getN().equals(decrypted_record.get(NUMBER_FIELD_NAME).getN());
122-
assert record.get(BINARY_FIELD_NAME).getB().equals(decrypted_record.get(BINARY_FIELD_NAME).getB());
139+
assert record
140+
.get(STRING_FIELD_NAME)
141+
.getS()
142+
.equals(decrypted_record.get(STRING_FIELD_NAME).getS());
143+
assert record
144+
.get(NUMBER_FIELD_NAME)
145+
.getN()
146+
.equals(decrypted_record.get(NUMBER_FIELD_NAME).getN());
147+
assert record
148+
.get(BINARY_FIELD_NAME)
149+
.getB()
150+
.equals(decrypted_record.get(BINARY_FIELD_NAME).getB());
123151
}
124152
}

examples/src/main/java/com/amazonaws/examples/AwsKmsEncryptedItem.java

+54-29
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,21 @@
1414
*/
1515
package com.amazonaws.examples;
1616

17-
import java.nio.ByteBuffer;
18-
import java.security.GeneralSecurityException;
19-
import java.util.EnumSet;
20-
import java.util.HashMap;
21-
import java.util.Map;
22-
import java.util.Set;
23-
2417
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.DynamoDBEncryptor;
2518
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionContext;
2619
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.EncryptionFlags;
2720
import com.amazonaws.services.dynamodbv2.datamodeling.encryption.providers.DirectKmsMaterialProvider;
2821
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
2922
import com.amazonaws.services.kms.AWSKMS;
3023
import com.amazonaws.services.kms.AWSKMSClientBuilder;
24+
import java.nio.ByteBuffer;
25+
import java.security.GeneralSecurityException;
26+
import java.util.EnumSet;
27+
import java.util.HashMap;
28+
import java.util.Map;
29+
import java.util.Set;
3130

32-
/**
33-
* Example showing use of AWS KMS CMP with record encryption functions directly.
34-
*/
31+
/** Example showing use of AWS KMS CMP with record encryption functions directly. */
3532
public class AwsKmsEncryptedItem {
3633
private static final String STRING_FIELD_NAME = "example";
3734
private static final String BINARY_FIELD_NAME = "and some binary";
@@ -54,7 +51,9 @@ public static void main(String[] args) throws GeneralSecurityException {
5451
}
5552
}
5653

57-
public static void encryptRecord(final String tableName, final String cmkArn, final AWSKMS kmsClient) throws GeneralSecurityException {
54+
public static void encryptRecord(
55+
final String tableName, final String cmkArn, final AWSKMS kmsClient)
56+
throws GeneralSecurityException {
5857
// Sample record to be encrypted
5958
final String partitionKeyName = "partition_attribute";
6059
final String sortKeyName = "sort_attribute";
@@ -63,26 +62,33 @@ public static void encryptRecord(final String tableName, final String cmkArn, fi
6362
record.put(sortKeyName, new AttributeValue().withN("55"));
6463
record.put(STRING_FIELD_NAME, new AttributeValue().withS("data"));
6564
record.put(NUMBER_FIELD_NAME, new AttributeValue().withN("99"));
66-
record.put(BINARY_FIELD_NAME, new AttributeValue().withB(ByteBuffer.wrap(new byte[]{0x00, 0x01, 0x02})));
67-
record.put(IGNORED_FIELD_NAME, new AttributeValue().withS("alone")); // We want to ignore this attribute
65+
record.put(
66+
BINARY_FIELD_NAME,
67+
new AttributeValue().withB(ByteBuffer.wrap(new byte[] {0x00, 0x01, 0x02})));
68+
record.put(
69+
IGNORED_FIELD_NAME,
70+
new AttributeValue().withS("alone")); // We want to ignore this attribute
6871

69-
// Set up our configuration and clients. All of this is thread-safe and can be reused across calls.
72+
// Set up our configuration and clients. All of this is thread-safe and can be reused across
73+
// calls.
7074
// This example assumes we already have a AWS KMS client `kmsClient`
7175
// Provider Configuration
7276
final DirectKmsMaterialProvider cmp = new DirectKmsMaterialProvider(kmsClient, cmkArn);
7377
// Encryptor creation
7478
final DynamoDBEncryptor encryptor = DynamoDBEncryptor.getInstance(cmp);
7579

7680
// Information about the context of our data (normally just Table information)
77-
final EncryptionContext encryptionContext = new EncryptionContext.Builder()
78-
.withTableName(tableName)
79-
.withHashKeyName(partitionKeyName)
80-
.withRangeKeyName(sortKeyName)
81-
.build();
81+
final EncryptionContext encryptionContext =
82+
new EncryptionContext.Builder()
83+
.withTableName(tableName)
84+
.withHashKeyName(partitionKeyName)
85+
.withRangeKeyName(sortKeyName)
86+
.build();
8287

8388
// Describe what actions need to be taken for each attribute
8489
final EnumSet<EncryptionFlags> signOnly = EnumSet.of(EncryptionFlags.SIGN);
85-
final EnumSet<EncryptionFlags> encryptAndSign = EnumSet.of(EncryptionFlags.ENCRYPT, EncryptionFlags.SIGN);
90+
final EnumSet<EncryptionFlags> encryptAndSign =
91+
EnumSet.of(EncryptionFlags.ENCRYPT, EncryptionFlags.SIGN);
8692
final Map<String, Set<EncryptionFlags>> actions = new HashMap<>();
8793
for (final String attributeName : record.keySet()) {
8894
switch (attributeName) {
@@ -103,13 +109,22 @@ public static void encryptRecord(final String tableName, final String cmkArn, fi
103109
// End set-up
104110

105111
// Encrypt the plaintext record directly
106-
final Map<String, AttributeValue> encrypted_record = encryptor.encryptRecord(record, actions, encryptionContext);
112+
final Map<String, AttributeValue> encrypted_record =
113+
encryptor.encryptRecord(record, actions, encryptionContext);
107114

108115
// Encrypted record fields change as expected
109-
assert encrypted_record.get(STRING_FIELD_NAME).getB() != null; // the encrypted string is stored as bytes
110-
assert encrypted_record.get(NUMBER_FIELD_NAME).getB() != null; // the encrypted number is stored as bytes
111-
assert !record.get(BINARY_FIELD_NAME).getB().equals(encrypted_record.get(BINARY_FIELD_NAME).getB()); // the encrypted bytes have updated
112-
assert record.get(IGNORED_FIELD_NAME).getS().equals(encrypted_record.get(IGNORED_FIELD_NAME).getS()); // ignored field is left as is
116+
assert encrypted_record.get(STRING_FIELD_NAME).getB()
117+
!= null; // the encrypted string is stored as bytes
118+
assert encrypted_record.get(NUMBER_FIELD_NAME).getB()
119+
!= null; // the encrypted number is stored as bytes
120+
assert !record
121+
.get(BINARY_FIELD_NAME)
122+
.getB()
123+
.equals(encrypted_record.get(BINARY_FIELD_NAME).getB()); // the encrypted bytes have updated
124+
assert record
125+
.get(IGNORED_FIELD_NAME)
126+
.getS()
127+
.equals(encrypted_record.get(IGNORED_FIELD_NAME).getS()); // ignored field is left as is
113128

114129
// We could now put the encrypted item to DynamoDB just as we would any other item.
115130
// We're skipping it to to keep the example simpler.
@@ -118,12 +133,22 @@ public static void encryptRecord(final String tableName, final String cmkArn, fi
118133
System.out.println("Encrypted Record: " + encrypted_record);
119134

120135
// Decryption is identical. We'll pretend that we retrieved the record from DynamoDB.
121-
final Map<String, AttributeValue> decrypted_record = encryptor.decryptRecord(encrypted_record, actions, encryptionContext);
136+
final Map<String, AttributeValue> decrypted_record =
137+
encryptor.decryptRecord(encrypted_record, actions, encryptionContext);
122138
System.out.println("Decrypted Record: " + decrypted_record);
123139

124140
// The decrypted fields match the original fields before encryption
125-
assert record.get(STRING_FIELD_NAME).getS().equals(decrypted_record.get(STRING_FIELD_NAME).getS());
126-
assert record.get(NUMBER_FIELD_NAME).getN().equals(decrypted_record.get(NUMBER_FIELD_NAME).getN());
127-
assert record.get(BINARY_FIELD_NAME).getB().equals(decrypted_record.get(BINARY_FIELD_NAME).getB());
141+
assert record
142+
.get(STRING_FIELD_NAME)
143+
.getS()
144+
.equals(decrypted_record.get(STRING_FIELD_NAME).getS());
145+
assert record
146+
.get(NUMBER_FIELD_NAME)
147+
.getN()
148+
.equals(decrypted_record.get(NUMBER_FIELD_NAME).getN());
149+
assert record
150+
.get(BINARY_FIELD_NAME)
151+
.getB()
152+
.equals(decrypted_record.get(BINARY_FIELD_NAME).getB());
128153
}
129154
}

0 commit comments

Comments
 (0)