public interface PrimitiveWrapper<B,P>
A PrimitiveSet can be wrapped by a single primitive in order to fulfil a cryptographic task.
This is done by the PrimitiveWrapper. Whenever a new primitive type is added to Tink, the user
should define a new PrimitiveWrapper and register it by calling com.google.crypto.tink.Registry#registerPrimitiveWrapper.
The primitive wrapper wraps primitives of type B into primitives of type P.
Often, these are the same classes, but in some cases they may not be. There can only be one
wrapper for each result primitive P (as Tink needs to know how to generate a P),
but there may be many wrapping the same B.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
PrimitiveWrapper.PrimitiveFactory<B>
Creates a primitive from an entry.
|
| Modifier and Type | Method and Description |
|---|---|
Class<B> |
getInputPrimitiveClass()
Returns the primitive class object of the primitive used to create B.
|
Class<P> |
getPrimitiveClass()
Returns the primitive class object of the primitive managed.
|
P |
wrap(KeysetHandleInterface keysetHandle,
MonitoringAnnotations annotations,
PrimitiveWrapper.PrimitiveFactory<B> primitiveFactory)
Wraps a
PrimitiveSet and returns a single instance. |
P wrap(KeysetHandleInterface keysetHandle, MonitoringAnnotations annotations, PrimitiveWrapper.PrimitiveFactory<B> primitiveFactory) throws GeneralSecurityException
PrimitiveSet and returns a single instance.
This method gets called when a new primitive is created.
GeneralSecurityExceptionClass<P> getPrimitiveClass()
return P.class; when implementing a wrapper creating objects
of type P.