Skip to content

Commit aaa11f6

Browse files
Merge pull request #40 from bdonlan/new-ctors
Add a builder API for constructing KMS MKPs
2 parents 3cd661d + 77cb424 commit aaa11f6

12 files changed

+952
-166
lines changed

src/main/java/com/amazonaws/encryptionsdk/kms/KmsMasterKey.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313

1414
package com.amazonaws.encryptionsdk.kms;
1515

16+
import javax.crypto.SecretKey;
17+
import javax.crypto.spec.SecretKeySpec;
1618
import java.nio.ByteBuffer;
1719
import java.nio.charset.StandardCharsets;
1820
import java.util.ArrayList;
1921
import java.util.Collection;
2022
import java.util.List;
2123
import java.util.Map;
2224

23-
import javax.crypto.SecretKey;
24-
import javax.crypto.spec.SecretKeySpec;
25-
2625
import com.amazonaws.AmazonServiceException;
2726
import com.amazonaws.auth.AWSCredentials;
2827
import com.amazonaws.auth.AWSCredentialsProvider;
@@ -52,10 +51,20 @@ public final class KmsMasterKey extends MasterKey<KmsMasterKey> implements KmsMe
5251
private final String id_;
5352
private final List<String> grantTokens_ = new ArrayList<>();
5453

54+
/**
55+
*
56+
* @deprecated Use a {@link KmsMasterKeyProvider} to obtain {@link KmsMasterKey}s.
57+
*/
58+
@Deprecated
5559
public static KmsMasterKey getInstance(final AWSCredentials creds, final String keyId) {
5660
return new KmsMasterKeyProvider(creds, keyId).getMasterKey(keyId);
5761
}
5862

63+
/**
64+
*
65+
* @deprecated Use a {@link KmsMasterKeyProvider} to obtain {@link KmsMasterKey}s.
66+
*/
67+
@Deprecated
5968
public static KmsMasterKey getInstance(final AWSCredentialsProvider creds, final String keyId) {
6069
return new KmsMasterKeyProvider(creds, keyId).getMasterKey(keyId);
6170
}
@@ -65,12 +74,6 @@ static KmsMasterKey getInstance(final AWSKMS kms, final String id,
6574
return new KmsMasterKey(kms, id, provider);
6675
}
6776

68-
private KmsMasterKey(final AWSKMS kms, final String id) {
69-
kms_ = kms;
70-
id_ = id;
71-
sourceProvider_ = this;
72-
}
73-
7477
private KmsMasterKey(final AWSKMS kms, final String id, final MasterKeyProvider<KmsMasterKey> provider) {
7578
kms_ = kms;
7679
id_ = id;

0 commit comments

Comments
 (0)