public final class MutablePrimitiveRegistry extends Object
PrimitiveRegistry.
This class probably shouldn't exist; it would be better if we had only the PrimitiveRegistry. However, at the moment, we need this, since a call to e.g.
AesCmacKeyManager.register()should register such an object into a global, mutable registry.
| Modifier and Type | Method and Description |
|---|---|
<WrapperPrimitiveT> |
getInputPrimitiveClass(Class<WrapperPrimitiveT> wrapperClassObject) |
<KeyT extends Key,PrimitiveT> |
getPrimitive(KeyT key,
Class<PrimitiveT> primitiveClass)
Creates a primitive from a given key.
|
static MutablePrimitiveRegistry |
globalInstance() |
<KeyT extends Key,PrimitiveT> |
registerPrimitiveConstructor(PrimitiveConstructor<KeyT,PrimitiveT> constructor)
Registers a key primitive constructor for later use in
getPrimitive(KeyT, java.lang.Class<PrimitiveT>). |
<InputPrimitiveT,WrapperPrimitiveT> |
registerPrimitiveWrapper(PrimitiveWrapper<InputPrimitiveT,WrapperPrimitiveT> wrapper) |
static void |
resetGlobalInstanceTestOnly() |
<InputPrimitiveT,WrapperPrimitiveT> |
wrap(PrimitiveSet<InputPrimitiveT> primitives,
Class<WrapperPrimitiveT> wrapperClassObject) |
public static MutablePrimitiveRegistry globalInstance()
public static void resetGlobalInstanceTestOnly()
public <KeyT extends Key,PrimitiveT> void registerPrimitiveConstructor(PrimitiveConstructor<KeyT,PrimitiveT> constructor) throws GeneralSecurityException
getPrimitive(KeyT, java.lang.Class<PrimitiveT>).
This registers a primitive constructor which can later be used to create a primitive by
calling getPrimitive(KeyT, java.lang.Class<PrimitiveT>). If a constructor for the pair (KeyT, PrimitiveT) has
already been registered and is the same, then the call is ignored; otherwise, an exception is
thrown.
GeneralSecurityExceptionpublic <InputPrimitiveT,WrapperPrimitiveT> void registerPrimitiveWrapper(PrimitiveWrapper<InputPrimitiveT,WrapperPrimitiveT> wrapper) throws GeneralSecurityException
GeneralSecurityExceptionpublic <KeyT extends Key,PrimitiveT> PrimitiveT getPrimitive(KeyT key, Class<PrimitiveT> primitiveClass) throws GeneralSecurityException
This will look up a previously registered constructor for the given pair of (KeyT,
PrimitiveT), and, if successful, use the registered PrimitiveConstructor object to create the
requested primitive. Throws if the required constructor has not been registered, or if the
primitive construction threw.
GeneralSecurityExceptionpublic <WrapperPrimitiveT> Class<?> getInputPrimitiveClass(Class<WrapperPrimitiveT> wrapperClassObject) throws GeneralSecurityException
GeneralSecurityExceptionpublic <InputPrimitiveT,WrapperPrimitiveT> WrapperPrimitiveT wrap(PrimitiveSet<InputPrimitiveT> primitives, Class<WrapperPrimitiveT> wrapperClassObject) throws GeneralSecurityException
GeneralSecurityException