Skip to content

Flag deprecated encryptString/decryptString APIs as deprecated. #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 9, 2019
Merged

This file was deleted.

42 changes: 39 additions & 3 deletions src/main/java/com/amazonaws/encryptionsdk/AwsCrypto.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,13 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> encryptData(final Master
/**
* Calls {@link #encryptData(MasterKeyProvider, byte[], Map)} on the UTF-8 encoded bytes of
* {@code plaintext} and base64 encodes the result.
* @deprecated Use the {@link #encryptData(MasterKeyProvider, byte[], Map)} and
* {@link #decryptData(MasterKeyProvider, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
final MasterKeyProvider<K> provider,
final String plaintext,
Expand All @@ -295,7 +301,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
/**
* Calls {@link #encryptData(CryptoMaterialsManager, byte[], Map)} on the UTF-8 encoded bytes of
* {@code plaintext} and base64 encodes the result.
* @deprecated Use the {@link #encryptData(CryptoMaterialsManager, byte[], Map)} and
* {@link #decryptData(CryptoMaterialsManager, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
public CryptoResult<String, ?> encryptString(
CryptoMaterialsManager materialsManager,
final String plaintext,
Expand All @@ -313,7 +325,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(
/**
* Returns the equivalent to calling {@link #encryptString(MasterKeyProvider, String, Map)} with
* an empty {@code encryptionContext}.
* @deprecated Use the {@link #encryptData(MasterKeyProvider, byte[])} and
* {@link #decryptData(MasterKeyProvider, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(final MasterKeyProvider<K> provider,
final String plaintext) {
return encryptString(provider, plaintext, EMPTY_MAP);
Expand All @@ -322,7 +340,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> encryptString(final Mast
/**
* Returns the equivalent to calling {@link #encryptString(CryptoMaterialsManager, String, Map)} with
* an empty {@code encryptionContext}.
* @deprecated Use the {@link #encryptData(CryptoMaterialsManager, byte[])} and
* {@link #decryptData(CryptoMaterialsManager, byte[])} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
public CryptoResult<String, ?> encryptString(
final CryptoMaterialsManager materialsManager,
final String plaintext
Expand All @@ -345,9 +369,9 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> decryptData(final Master
* Decrypts the provided ciphertext by delegating to the provided materialsManager to obtain the decrypted
* {@link DataKey}.
*
* @param materialsManager
* @param ciphertext
* @return
* @param materialsManager the {@link CryptoMaterialsManager} to use for decryption operations.
* @param ciphertext the ciphertext to attempt to decrypt.
* @return the {@link CryptoResult} with the decrypted data.
*/
public CryptoResult<byte[], ?> decryptData(
final CryptoMaterialsManager materialsManager,
Expand Down Expand Up @@ -402,7 +426,13 @@ public <K extends MasterKey<K>> CryptoResult<byte[], K> decryptData(
* UTF-8 encoded string.
*
* @see #decryptData(MasterKeyProvider, byte[])
* @deprecated Use the {@link #decryptData(MasterKeyProvider, byte[])} and
* {@link #encryptData(MasterKeyProvider, byte[], Map)} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
@SuppressWarnings("unchecked")
public <K extends MasterKey<K>> CryptoResult<String, K> decryptString(
final MasterKeyProvider<K> provider,
Expand All @@ -416,7 +446,13 @@ public <K extends MasterKey<K>> CryptoResult<String, K> decryptString(
* UTF-8 encoded string.
*
* @see #decryptData(CryptoMaterialsManager, byte[])
* @deprecated Use the {@link #decryptData(CryptoMaterialsManager, byte[])} and
* {@link #encryptData(CryptoMaterialsManager, byte[], Map)} APIs instead. {@code encryptString} and {@code decryptString}
* work as expected if you use them together. However, to work with other language implementations of the AWS
* Encryption SDK, you need to base64-decode the output of {@code encryptString} and base64-encode the input to
* {@code decryptString}. These deprecated APIs will be removed in the future.
*/
@Deprecated
public CryptoResult<String, ?> decryptString(final CryptoMaterialsManager provider,
final String ciphertext) {
Utils.assertNonNull(provider, "provider");
Expand Down