@@ -9,7 +9,7 @@ It also supports writing objects with non-legacy algorithms.
99The list of legacy modes and operations will be provided below.
1010
1111### Examples
12- #### V2 KMS Materials Provider to V3 KMS w/ Context Materials Manager and Keyring
12+ #### V2 KMS Materials Provider to V3
1313``` java
1414class Example {
1515 public static void main (String [] args ) {
@@ -20,21 +20,14 @@ class Example {
2020 .build();
2121
2222 // V3
23- Keyring keyring = KmsContextKeyring . builder()
24- .wrappingKeyId(KMS_WRAPPING_KEY_ID )
25- .build();
26-
27- MaterialsManager materialsManager = DefaultMaterialsManager . builder()
28- .keyring(keyring)
29- .build();
3023 S3Client v3Client = S3EncryptionClient . builder()
31- .materialsManager(materialsManager )
24+ .kmsKeyId( KMS_WRAPPING_KEY_ID )
3225 .build();
3326 }
3427}
3528```
3629
37- #### V2 AES Key Materials Provider to V3 AES/GCM Materials Manager and Keyring
30+ #### V2 AES Key Materials Provider to V3
3831``` java
3932class Example {
4033 public static void main (String [] args ) {
@@ -49,21 +42,14 @@ class Example {
4942 .build();
5043
5144 // V3
52- Keyring keyring = AesGcmKeyring . builder()
53- .wrappingKey(aesKey)
54- .build();
55-
56- MaterialsManager materialsManager = DefaultMaterialsManager . builder()
57- .keyring(keyring)
58- .build();
5945 S3Client v3Client = S3EncryptionClient . builder()
60- .materialsManager(materialsManager )
46+ .aesKey(aesKey )
6147 .build();
6248 }
6349}
6450```
6551
66- #### V2 RSA Key Materials Provider to V3 RSA-OAEP Materials Manager and Keyring
52+ #### V2 RSA Key Materials Provider to V3
6753``` java
6854class Example {
6955 public static void main (String [] args ) {
@@ -78,22 +64,15 @@ class Example {
7864 .build();
7965
8066 // V3
81- Keyring keyring = RsaOaepKeyring . builder()
82- .wrappingKeyPair(rsaKey)
83- .build();
84-
85- MaterialsManager materialsManager = DefaultMaterialsManager . builder()
86- .keyring(keyring)
87- .build();
8867 S3Client v3Client = S3EncryptionClient . builder()
89- .materialsManager(materialsManager )
68+ .rsaKeyPair(rsaKey )
9069 .build();
9170 }
9271}
9372```
9473
95- #### V1 Key Materials Provider to V3 AES/GCM Materials Manager, Legacy AESWrap Keyring, and Keyring
96- Since legacy algorithms are supported for decryption only, a non-legacy keyring is required for any writes.
74+ #### V1 Key Materials Provider to V3
75+ To allow legacy modes ( for decryption only), you must explicitly allow them
9776``` java
9877class Example {
9978 public static void main (String [] args ) {
@@ -108,20 +87,9 @@ class Example {
10887 .build();
10988
11089 // V3
111- Keyring keyring = AesGcmKeyring . builder()
112- .wrappingKey(aesKey)
113- .build();
114-
115- Keyring legacyKeyring = AesWrapKeyring . builder()
116- .wrappingKey(aesKey)
117- .build();
118-
119- MaterialsManager materialsManager = LegacyDecryptMaterialsManager . builder()
120- .keyring(keyring)
121- .legacyKeyring(legacyKeyring)
122- .build();
12390 S3Client v3Client = S3EncryptionClient . builder()
124- .materialsManager(materialsManager)
91+ .aesKey(aesKey)
92+ .enableLegacyModes(true )
12593 .build();
12694 }
12795}
@@ -131,6 +99,7 @@ class Example {
13199#### Content Encryption
132100* AES/CBC
133101#### Key Wrap Encryption
102+ * AES
134103* AESWrap
135104* RSA-OAEP w/MGF-1 and SHA-256
136105* KMS (without context)
0 commit comments