|
2 | 2 |
|
3 | 3 | This library provides an S3 client that supports client-side encryption. |
4 | 4 |
|
| 5 | +## Migration |
| 6 | + |
| 7 | +This version of the library supports reading encrypted objects from previous versions. |
| 8 | +It also supports writing objects with non-legacy algorithms. |
| 9 | +The list of legacy modes and operations will be provided below. |
| 10 | + |
| 11 | +### Examples |
| 12 | +#### V2 KMS Materials Provider to V3 KMS w/ Context Materials Manager and Keyring |
| 13 | +```java |
| 14 | +class Example { |
| 15 | + public static void main(String[] args) { |
| 16 | + // V2 |
| 17 | + EncryptionMaterialsProvider materialsProvider = new KMSEncryptionMaterialsProvider(KMS_WRAPPING_KEY_ID); |
| 18 | + AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder() |
| 19 | + .withEncryptionMaterialsProvider(materialsProvider) |
| 20 | + .build(); |
| 21 | + |
| 22 | + // V3 |
| 23 | + Keyring keyring = KmsContextKeyring.builder() |
| 24 | + .wrappingKeyId(KMS_WRAPPING_KEY_ID) |
| 25 | + .build(); |
| 26 | + |
| 27 | + MaterialsManager materialsManager = new DefaultMaterialsManager(keyring); |
| 28 | + S3EncryptionClient v3Client = S3EncryptionClient.builder() |
| 29 | + .materialsManager(materialsManager) |
| 30 | + .build(); |
| 31 | + } |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +#### V2 AES Key Materials Provider to V3 AES/GCM Materials Manager and Keyring |
| 36 | +```java |
| 37 | +class Example { |
| 38 | + public static void main(String[] args) { |
| 39 | + KeyGenerator keyGen = KeyGenerator.getInstance("AES"); |
| 40 | + keyGen.init(256); |
| 41 | + SecretKey aesKey = keyGen.generateKey(); |
| 42 | + |
| 43 | + // V2 |
| 44 | + EncryptionMaterialsProvider materialsProvider = new StaticEncryptionMaterialsProvider(new EncryptionMaterials(aesKey)); |
| 45 | + AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder() |
| 46 | + .withEncryptionMaterialsProvider(materialsProvider) |
| 47 | + .build(); |
| 48 | + |
| 49 | + // V3 |
| 50 | + Keyring keyring = AesGcmKeyring.builder() |
| 51 | + .wrappingKey(aesKey) |
| 52 | + .build(); |
| 53 | + |
| 54 | + MaterialsManager materialsManager = new DefaultMaterialsManager(keyring); |
| 55 | + S3EncryptionClient v3Client = S3EncryptionClient.builder() |
| 56 | + .materialsManager(materialsManager) |
| 57 | + .build(); |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +#### V2 RSA Key Materials Provider to V3 RSA-OAEP Materials Manager and Keyring |
| 63 | +```java |
| 64 | +class Example { |
| 65 | + public static void main(String[] args) { |
| 66 | + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); |
| 67 | + keyPairGen.initialize(2048); |
| 68 | + KeyPair rsaKey = keyPairGen.generateKeyPair(); |
| 69 | + |
| 70 | + // V2 |
| 71 | + EncryptionMaterialsProvider materialsProvider = new StaticEncryptionMaterialsProvider(new EncryptionMaterials(rsaKey)); |
| 72 | + AmazonS3EncryptionV2 v2Client = AmazonS3EncryptionClientV2.encryptionBuilder() |
| 73 | + .withEncryptionMaterialsProvider(materialsProvider) |
| 74 | + .build(); |
| 75 | + |
| 76 | + // V3 |
| 77 | + Keyring keyring = RsaOaepKeyring.builder() |
| 78 | + .wrappingKeyPair(rsaKey) |
| 79 | + .build(); |
| 80 | + |
| 81 | + MaterialsManager materialsManager = new DefaultMaterialsManager(keyring); |
| 82 | + S3EncryptionClient v3Client = S3EncryptionClient.builder() |
| 83 | + .materialsManager(materialsManager) |
| 84 | + .build(); |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +### Legacy Algorithms and Modes |
| 90 | +#### Content Encryption |
| 91 | +* AES/CBC |
| 92 | +#### Key Wrap Encryption |
| 93 | +* AESWrap |
| 94 | +* RSA-OAEP w/MGF-1 and SHA-256 |
| 95 | +* KMS (without context) |
| 96 | +#### Encryption Metadata Storage |
| 97 | +* Instruction File |
| 98 | + |
5 | 99 | ## Security |
6 | 100 |
|
7 | 101 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. |
|
0 commit comments