File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,41 @@ class Example {
8686}
8787```
8888
89+ #### V1 Key Materials Provider to V3 AES/GCM Materials Manager, Legacy AESWrap Keyring, and Keyring
90+ Since legacy algorithms are supported for decryption only, a non-legacy keyring is required for any writes.
91+ ``` java
92+ class Example {
93+ public static void main (String [] args ) {
94+ KeyGenerator keyGen = KeyGenerator . getInstance(" AES" );
95+ keyGen. init(256 );
96+ SecretKey aesKey = keyGen. generateKey();
97+
98+ // V1
99+ EncryptionMaterialsProvider materialsProvider = new StaticEncryptionMaterialsProvider (new EncryptionMaterials (aesKey));
100+ AmazonS3Encryption v1Client = AmazonS3EncryptionClient . encryptionBuilder()
101+ .withEncryptionMaterials(materialsProvider)
102+ .build();
103+
104+ // V3
105+ // Create the non-legacy keyring first
106+ Keyring keyring = AesGcmKeyring . builder()
107+ .wrappingKey(aesKey)
108+ .build();
109+
110+ // Create the legacy keyring, passing in the non-legacy keyring
111+ keyring = AesWrapKeyring . builder()
112+ .wrappingKey(aesKey)
113+ .nonLegacyKeyring(keyring)
114+ .build();
115+
116+ MaterialsManager materialsManager = new DefaultMaterialsManager (keyring);
117+ S3Client v3Client = S3EncryptionClient . builder()
118+ .materialsManager(materialsManager)
119+ .build();
120+ }
121+ }
122+ ```
123+
89124### Legacy Algorithms and Modes
90125#### Content Encryption
91126* AES/CBC
You can’t perform that action at this time.
0 commit comments