K - the concrete type of the MasterKeypublic abstract class MasterKey<K extends MasterKey<K>> extends MasterKeyProvider<K>
DataKey (which, in turn, protects
the data).
All MasterKeys extend MasterKeyProvider because they are all capable of providing
exactly themselves. This simplifies implementation when only a single MasterKey is used
and/or expected.
| Constructor and Description |
|---|
MasterKey() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canProvide(String provider)
|
abstract DataKey<K> |
encryptDataKey(CryptoAlgorithm algorithm,
Map<String,String> encryptionContext,
DataKey<?> dataKey)
Returns a new copy of the provided
dataKey which is protected by this MasterKey
for use with algorithm and associated with the provided encryptionContext. |
boolean |
equals(Object obj)
Two
MasterKeys are equal if they are instances of the exact same class and
their values for keyId, providerId, and defaultProviderId are equal. |
abstract DataKey<K> |
generateDataKey(CryptoAlgorithm algorithm,
Map<String,String> encryptionContext)
|
String |
getDefaultProviderId()
Equivalent to calling
getProviderId(). |
abstract String |
getKeyId() |
K |
getMasterKey(String provider,
String keyId)
Returns
this if provider and keyId match this. |
List<K> |
getMasterKeysForEncryption(MasterKeyRequest request)
Returns a list of length
1 containing this. |
abstract String |
getProviderId() |
int |
hashCode() |
String |
toString() |
buildCannotDecryptDksException, buildCannotDecryptDksException, buildCannotDecryptDksException, decryptDataKey, getMasterKeypublic abstract String getProviderId()
public String getDefaultProviderId()
getProviderId().getDefaultProviderId in class MasterKeyProvider<K extends MasterKey<K>>public abstract String getKeyId()
public abstract DataKey<K> generateDataKey(CryptoAlgorithm algorithm, Map<String,String> encryptionContext)
public abstract DataKey<K> encryptDataKey(CryptoAlgorithm algorithm, Map<String,String> encryptionContext, DataKey<?> dataKey)
dataKey which is protected by this MasterKey
for use with algorithm and associated with the provided encryptionContext.public boolean canProvide(String provider)
canProvide in class MasterKeyProvider<K extends MasterKey<K>>public K getMasterKey(String provider, String keyId) throws UnsupportedProviderException, NoSuchMasterKeyException
this if provider and keyId match this. Otherwise,
throws an appropriate exception.getMasterKey in class MasterKeyProvider<K extends MasterKey<K>>UnsupportedProviderException - if this object cannot return MasterKeys associated
with the given providerNoSuchMasterKeyException - if this object cannot find (and thus construct) the MasterKey associated with keyIdpublic List<K> getMasterKeysForEncryption(MasterKeyRequest request)
1 containing this.getMasterKeysForEncryption in class MasterKeyProvider<K extends MasterKey<K>>public boolean equals(Object obj)
MasterKeys are equal if they are instances of the exact same class and
their values for keyId, providerId, and defaultProviderId are equal.Copyright © 2023. All rights reserved.