public final class KeyManagerRegistry extends Object
The KeyManagerRegistry provides an API to register KeyManagers, ensuring FIPS compatibility. For registered managers, it gives access to the following operations:
| Constructor and Description |
|---|
KeyManagerRegistry() |
KeyManagerRegistry(KeyManagerRegistry original) |
| Modifier and Type | Method and Description |
|---|---|
<P> KeyManager<P> |
getKeyManager(String typeUrl,
Class<P> primitiveClass) |
KeyManager<?> |
getUntypedKeyManager(String typeUrl) |
static KeyManagerRegistry |
globalInstance()
Returns the global instance.
|
boolean |
isEmpty() |
boolean |
isNewKeyAllowed(String typeUrl) |
<P> void |
registerKeyManager(KeyManager<P> manager,
boolean newKeyAllowed)
Attempts to insert the given KeyManager into the object.
|
<P> void |
registerKeyManagerWithFipsCompatibility(KeyManager<P> manager,
TinkFipsUtil.AlgorithmFipsCompatibility compatibility,
boolean newKeyAllowed)
Attempts to insert the given KeyManager into the object; the caller guarantees that the given
key manager satisfies the given FIPS compatibility.
|
static void |
resetGlobalInstanceTestOnly()
Resets the global instance.
|
void |
restrictToFipsIfEmptyAndGlobalInstance()
Restricts Tink to FIPS if this is the global instance.
|
boolean |
typeUrlExists(String typeUrl) |
public KeyManagerRegistry(KeyManagerRegistry original)
public KeyManagerRegistry()
public static KeyManagerRegistry globalInstance()
public static void resetGlobalInstanceTestOnly()
public <P> void registerKeyManager(KeyManager<P> manager, boolean newKeyAllowed) throws GeneralSecurityException
GeneralSecurityExceptionpublic <P> void registerKeyManagerWithFipsCompatibility(KeyManager<P> manager, TinkFipsUtil.AlgorithmFipsCompatibility compatibility, boolean newKeyAllowed) throws GeneralSecurityException
GeneralSecurityExceptionpublic boolean typeUrlExists(String typeUrl)
public <P> KeyManager<P> getKeyManager(String typeUrl, Class<P> primitiveClass) throws GeneralSecurityException
KeyManager for the given typeUrl and primitiveClass(if found
and this key type supports this primitive).GeneralSecurityExceptionpublic KeyManager<?> getUntypedKeyManager(String typeUrl) throws GeneralSecurityException
KeyManager for the given typeUrl (if found).GeneralSecurityExceptionpublic boolean isNewKeyAllowed(String typeUrl)
public boolean isEmpty()
public void restrictToFipsIfEmptyAndGlobalInstance()
throws GeneralSecurityException
We make this a member method (instead of a static one which gets the global instance) because the call to "useOnlyFips" needs to happen under the same mutex lock which protects the registerKeyManager methods.
GeneralSecurityException