Skip to content

Commit 876dd5e

Browse files
Updating wording and adding more Deprecated annotations
1 parent 7ec91d6 commit 876dd5e

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
* byte-arrays and streams. This data is encrypted using the specified {@link CryptoAlgorithm} and a
5656
* {@code plaintextDataKey} which is unique to each encrypted message. This {@code plaintextDataKey} is then encrypted
5757
* using one (or more) {@link MasterKey MasterKeys} or a {@link Keyring}. The process is reversed on decryption with the
58-
* code selecting a copy of the {@code EncryptedDataKey} protected by a usable {@code MasterKey} or {@code Keyring},
59-
* decrypting the {@code EncryptedDataKey}, and then decrypting the message.
58+
* code selecting an {@code EncryptedDataKey} embedded in the encrypted message, decrypting the {@code EncryptedDataKey}
59+
* using a {@link MasterKey MasterKey} or {@link Keyring}, and then decrypting the message.
6060
*
6161
* <p>
6262
* Note:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public Map<String, String> getEncryptionContext() {
7676
}
7777

7878
/**
79-
* Convenience method equivalent to {@link #getHeaders()}.{@code getCryptoAlgoId()}.
79+
* Convenience method equivalent to {@link #getHeaders()}{@code .getCryptoAlgoId()}.
8080
*/
8181
public CryptoAlgorithm getAlgorithmSuite() {
8282
return headers.getCryptoAlgoId();

src/main/java/com/amazonaws/encryptionsdk/internal/DecryptionHandler.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.amazonaws.encryptionsdk.MasterKeyProvider;
3535
import com.amazonaws.encryptionsdk.exception.AwsCryptoException;
3636
import com.amazonaws.encryptionsdk.exception.BadCiphertextException;
37+
import com.amazonaws.encryptionsdk.keyrings.Keyring;
3738
import com.amazonaws.encryptionsdk.keyrings.KeyringTrace;
3839
import com.amazonaws.encryptionsdk.model.CiphertextFooters;
3940
import com.amazonaws.encryptionsdk.model.CiphertextHeaders;
@@ -111,8 +112,11 @@ private DecryptionHandler(final CryptoMaterialsManager materialsManager, final C
111112
* the key blobs encoded in the provided ciphertext.
112113
* @throws AwsCryptoException
113114
* if the master key is null.
115+
* @deprecated MasterKeyProviders have been deprecated in favor of {@link Keyring}s.
116+
* Use {@link #create(CryptoMaterialsManager)} instead.
114117
*/
115118
@SuppressWarnings("unchecked")
119+
@Deprecated
116120
public static <K extends MasterKey<K>> DecryptionHandler<K> create(
117121
final MasterKeyProvider<K> customerMasterKeyProvider
118122
) throws AwsCryptoException {
@@ -136,8 +140,11 @@ public static <K extends MasterKey<K>> DecryptionHandler<K> create(
136140
* {@link #processBytes(byte[], int, int, byte[], int)}
137141
* @throws AwsCryptoException
138142
* if the master key is null.
143+
* @deprecated MasterKeyProviders have been deprecated in favor of {@link Keyring}s.
144+
* Use {@link #create(CryptoMaterialsManager, CiphertextHeaders)} instead.
139145
*/
140146
@SuppressWarnings("unchecked")
147+
@Deprecated
141148
public static <K extends MasterKey<K>> DecryptionHandler<K> create(
142149
final MasterKeyProvider<K> customerMasterKeyProvider, final CiphertextHeaders headers
143150
) throws AwsCryptoException {
@@ -537,7 +544,15 @@ public CiphertextHeaders getHeaders() {
537544
return ciphertextHeaders_;
538545
}
539546

547+
/**
548+
* The master key that was used to decrypt the encrypted data key. This returns an
549+
* empty list if Keyrings are in use.
550+
*
551+
* @deprecated MasterKeys have been deprecated in favor of {@link Keyring}s.
552+
* Use {@link #getKeyringTrace()} to view which key was used in decryption.
553+
*/
540554
@Override
555+
@Deprecated
541556
public List<K> getMasterKeys() {
542557
if(dataKey_.getMasterKey() == null) {
543558
return Collections.emptyList();

src/main/java/com/amazonaws/encryptionsdk/internal/EncryptionHandler.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
import java.security.Signature;
2222
import java.security.SignatureException;
2323
import java.security.interfaces.ECPrivateKey;
24+
import java.util.Collections;
2425
import java.util.List;
2526
import java.util.Map;
2627

2728
import javax.crypto.Cipher;
2829
import javax.crypto.SecretKey;
2930

31+
import com.amazonaws.encryptionsdk.keyrings.Keyring;
3032
import com.amazonaws.encryptionsdk.keyrings.KeyringTrace;
3133
import org.bouncycastle.asn1.ASN1Encodable;
3234
import org.bouncycastle.asn1.ASN1Integer;
@@ -408,8 +410,19 @@ private CiphertextHeaders signCiphertextHeaders(final CiphertextHeaders unsigned
408410
return unsignedHeaders;
409411
}
410412

413+
/**
414+
* The master keys that were used to encrypt the data key. This returns an
415+
* empty list if Keyrings are in use.
416+
*
417+
* @deprecated MasterKeys have been deprecated in favor of {@link Keyring}s.
418+
* Use {@link #getKeyringTrace()} to view which key were used in encryption.
419+
*/
411420
@Override
421+
@Deprecated
412422
public List<? extends MasterKey<?>> getMasterKeys() {
423+
if(masterKeys_ == null) {
424+
return Collections.emptyList();
425+
}
413426
//noinspection unchecked
414427
return (List)masterKeys_; // This is unmodifiable
415428
}

src/main/java/com/amazonaws/encryptionsdk/internal/MessageCryptoHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public interface MessageCryptoHandler extends CryptoHandler {
5050
* All <em>used</em> {@link MasterKey}s. For encryption flows, these are all the
5151
* {@link MasterKey}s used to protect the data. In the decryption flow, it is the single
5252
* {@link MasterKey} actually used to decrypt the data.
53+
*
54+
* @deprecated MasterKeys and MasterKeyProviders have been deprecated in favor of {@link Keyring}s
5355
*/
5456
@Deprecated
5557
List<? extends MasterKey<?>> getMasterKeys();

0 commit comments

Comments
 (0)