public final class PrimitiveSet<P> extends Object
It provides also additional properties for the primitives it holds. In particular, one of the primitives in the set can be distinguished as "the primary" one.
PrimitiveSet is an auxiliary class used for supporting key rotation: primitives in a set correspond to keys in a keyset. Users will usually work with primitive instances, which essentially wrap primitive sets. For example an instance of an Aead-primitive for a given keyset holds a set of Aead-primitives corresponding to the keys in the keyset, and uses the set members to do the actual crypto operations: to encrypt data the primary Aead-primitive from the set is used, and upon decryption the ciphertext's prefix determines the id of the primitive from the set.
PrimitiveSet is a public class to allow its use in implementations of custom primitives.
| Modifier and Type | Class and Description |
|---|---|
static class |
PrimitiveSet.Builder<P>
Builds an immutable PrimitiveSet.
|
static class |
PrimitiveSet.Entry<P>
A single entry in the set.
|
| Modifier and Type | Method and Description |
|---|---|
PrimitiveSet.Entry<P> |
addPrimitive(P primitive,
Keyset.Key key)
Deprecated.
use
Builder.addPrimitive or Builder.addPrimaryPrimitive instead. |
Collection<List<PrimitiveSet.Entry<P>>> |
getAll() |
MonitoringAnnotations |
getAnnotations() |
PrimitiveSet.Entry<P> |
getPrimary()
Returns the entry with the primary primitive.
|
List<PrimitiveSet.Entry<P>> |
getPrimitive(byte[] identifier) |
Class<P> |
getPrimitiveClass() |
List<PrimitiveSet.Entry<P>> |
getRawPrimitives() |
boolean |
hasAnnotations() |
static <P> PrimitiveSet.Builder<P> |
newBuilder(Class<P> primitiveClass) |
static <P> PrimitiveSet<P> |
newPrimitiveSet(Class<P> primitiveClass)
Deprecated.
use
PrimitiveSet.Builder instead. |
void |
setPrimary(PrimitiveSet.Entry<P> primary)
Deprecated.
use
Builder.addPrimaryPrimitive instead. |
@Nullable public PrimitiveSet.Entry<P> getPrimary()
public boolean hasAnnotations()
public MonitoringAnnotations getAnnotations()
public List<PrimitiveSet.Entry<P>> getRawPrimitives()
public List<PrimitiveSet.Entry<P>> getPrimitive(byte[] identifier)
identifier.public Collection<List<PrimitiveSet.Entry<P>>> getAll()
@Deprecated public static <P> PrimitiveSet<P> newPrimitiveSet(Class<P> primitiveClass)
PrimitiveSet.Builder instead.@Deprecated public void setPrimary(PrimitiveSet.Entry<P> primary)
Builder.addPrimaryPrimitive instead.primary as the primary one.IllegalStateException - if object has been created by the PrimitiveSet.Builder.@Deprecated @CanIgnoreReturnValue public PrimitiveSet.Entry<P> addPrimitive(P primitive, Keyset.Key key) throws GeneralSecurityException
Builder.addPrimitive or Builder.addPrimaryPrimitive instead.PrimitiveSet.EntryIllegalStateException - if object has been created by the PrimitiveSet.Builder.GeneralSecurityExceptionpublic static <P> PrimitiveSet.Builder<P> newBuilder(Class<P> primitiveClass)