public interface KeyManagementService<T>
extends java.io.Closeable
getKey(short, short)
calls.
T refers to the Key type that this KeyManagementService
will generate and return.
Ensure that CryptoService
implementation is compatible with the key type that
KeyManagementService
generatesModifier and Type | Method and Description |
---|---|
T |
getKey(short accountId,
short containerId)
Fetches the key associated with the pair of AccountId and ContainerId.
|
T |
getKey(java.lang.String context)
Fetches the key associated with the specified context.
|
T |
getRandomKey()
Generate and return a random key (of type T)
|
void |
register(short accountId,
short containerId)
Registers with KMS to create key for a unique pair of AccountId and ContainerId
|
void |
register(java.lang.String context)
Registers with KMS to create key for a unique context.
|
void register(short accountId, short containerId) throws java.security.GeneralSecurityException
void register(java.lang.String context) throws java.security.GeneralSecurityException
context
- refers to the key context to register{@link
- GeneralSecurityException} on KMS unavailability or duplicate registrationjava.security.GeneralSecurityException
T getKey(short accountId, short containerId) throws java.security.GeneralSecurityException
register(short, short)
for this pair before fetching keys.accountId
- refers to the id of the Account
for which key is expectedcontainerId
- refers to the id of the Container
for which key is expected{@link
- GeneralSecurityException} on KMS unavailability or if key is not registeredjava.security.GeneralSecurityException
T getKey(java.lang.String context) throws java.security.GeneralSecurityException
register(String)
for this context before fetching keys.context
- refers to the context for which key is expected{@link
- GeneralSecurityException} on KMS unavailability or if key is not registeredjava.security.GeneralSecurityException
T getRandomKey() throws java.security.GeneralSecurityException
java.security.GeneralSecurityException