Skip to content

Commit a600292

Browse files
authored
Merge pull request #120 from lizroth/update-deprecated-api-flags
Flag deprecated encryptString/decryptString APIs as deprecated. Update Javadoc. Remove example for deprecated APIs.
2 parents f2daec3 + 22a90bf commit a600292

File tree

2 files changed

+39
-87
lines changed

2 files changed

+39
-87
lines changed

src/examples/java/com/amazonaws/crypto/examples/StringExample.java

-84
This file was deleted.

src/main/java/com/amazonaws/encryptionsdk/AwsCrypto.java

+39-3
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,13 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> encryptData(final Master
281281
/**
282282
* Calls {@link #encryptData(MasterKeyProvider, byte[], Map)} on the UTF-8 encoded bytes of
283283
* {@code plaintext} and base64 encodes the result.
284+
* @deprecated Use the {@link #encryptData(MasterKeyProvider, byte[], Map)} and
285+
* {@link #decryptData(MasterKeyProvider, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
286+
* work as expected if you use them together. However, to work with other language implementations of the AWS
287+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
288+
* {@code decryptString}. These deprecated APIs will be removed in the future.
284289
*/
290+
@Deprecated
285291
public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
286292
final MasterKeyProvider<K> provider,
287293
final String plaintext,
@@ -295,7 +301,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
295301
/**
296302
* Calls {@link #encryptData(CryptoMaterialsManager, byte[], Map)} on the UTF-8 encoded bytes of
297303
* {@code plaintext} and base64 encodes the result.
304+
* @deprecated Use the {@link #encryptData(CryptoMaterialsManager, byte[], Map)} and
305+
* {@link #decryptData(CryptoMaterialsManager, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
306+
* work as expected if you use them together. However, to work with other language implementations of the AWS
307+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
308+
* {@code decryptString}. These deprecated APIs will be removed in the future.
298309
*/
310+
@Deprecated
299311
public CryptoResult<String, ?> encryptString(
300312
CryptoMaterialsManager materialsManager,
301313
final String plaintext,
@@ -313,7 +325,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
313325
/**
314326
* Returns the equivalent to calling {@link #encryptString(MasterKeyProvider, String, Map)} with
315327
* an empty {@code encryptionContext}.
328+
* @deprecated Use the {@link #encryptData(MasterKeyProvider, byte[])} and
329+
* {@link #decryptData(MasterKeyProvider, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
330+
* work as expected if you use them together. However, to work with other language implementations of the AWS
331+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
332+
* {@code decryptString}. These deprecated APIs will be removed in the future.
316333
*/
334+
@Deprecated
317335
public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(final MasterKeyProvider<K> provider,
318336
final String plaintext) {
319337
return encryptString(provider, plaintext, EMPTY_MAP);
@@ -322,7 +340,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(final Mast
322340
/**
323341
* Returns the equivalent to calling {@link #encryptString(CryptoMaterialsManager, String, Map)} with
324342
* an empty {@code encryptionContext}.
343+
* @deprecated Use the {@link #encryptData(CryptoMaterialsManager, byte[])} and
344+
* {@link #decryptData(CryptoMaterialsManager, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
345+
* work as expected if you use them together. However, to work with other language implementations of the AWS
346+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
347+
* {@code decryptString}. These deprecated APIs will be removed in the future.
325348
*/
349+
@Deprecated
326350
public CryptoResult<String, ?> encryptString(
327351
final CryptoMaterialsManager materialsManager,
328352
final String plaintext
@@ -345,9 +369,9 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> decryptData(final Master
345369
* Decrypts the provided ciphertext by delegating to the provided materialsManager to obtain the decrypted
346370
* {@link DataKey}.
347371
*
348-
* @param materialsManager
349-
* @param ciphertext
350-
* @return
372+
* @param materialsManager the {@link CryptoMaterialsManager} to use for decryption operations.
373+
* @param ciphertext the ciphertext to attempt to decrypt.
374+
* @return the {@link CryptoResult} with the decrypted data.
351375
*/
352376
public CryptoResult<byte[], ?> decryptData(
353377
final CryptoMaterialsManager materialsManager,
@@ -402,7 +426,13 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> decryptData(
402426
* UTF-8 encoded string.
403427
*
404428
* @see #decryptData(MasterKeyProvider, byte[])
429+
* @deprecated Use the {@link #decryptData(MasterKeyProvider, byte[])} and
430+
* {@link #encryptData(MasterKeyProvider, byte[], Map)} APIs instead. {@code encryptString} and {@code decryptString}
431+
* work as expected if you use them together. However, to work with other language implementations of the AWS
432+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
433+
* {@code decryptString}. These deprecated APIs will be removed in the future.
405434
*/
435+
@Deprecated
406436
@SuppressWarnings("unchecked")
407437
public <K extends MasterKey<K>> CryptoResult<String, K> decryptString(
408438
final MasterKeyProvider<K> provider,
@@ -416,7 +446,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> decryptString(
416446
* UTF-8 encoded string.
417447
*
418448
* @see #decryptData(CryptoMaterialsManager, byte[])
449+
* @deprecated Use the {@link #decryptData(CryptoMaterialsManager, byte[])} and
450+
* {@link #encryptData(CryptoMaterialsManager, byte[], Map)} APIs instead. {@code encryptString} and {@code decryptString}
451+
* work as expected if you use them together. However, to work with other language implementations of the AWS
452+
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
453+
* {@code decryptString}. These deprecated APIs will be removed in the future.
419454
*/
455+
@Deprecated
420456
public CryptoResult<String, ?> decryptString(final CryptoMaterialsManager provider,
421457
final String ciphertext) {
422458
Utils.assertNonNull(provider, "provider");

0 commit comments

Comments
 (0)