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.Entry<P>
A single entry in the set.
|
| Constructor and Description |
|---|
PrimitiveSet() |
| Modifier and Type | Method and Description |
|---|---|
protected PrimitiveSet.Entry<P> |
addPrimitive(P primitive,
Keyset.Key key)
Creates an entry in the primitive table.
|
Collection<List<PrimitiveSet.Entry<P>>> |
getAll() |
PrimitiveSet.Entry<P> |
getPrimary() |
List<PrimitiveSet.Entry<P>> |
getPrimitive(byte[] identifier) |
protected List<PrimitiveSet.Entry<P>> |
getPrimitive(Keyset.Key key) |
List<PrimitiveSet.Entry<P>> |
getRawPrimitives() |
protected static <P> PrimitiveSet<P> |
newPrimitiveSet() |
protected void |
setPrimary(PrimitiveSet.Entry<P> primary)
Sets given Entry
primary as the primary one. |
public PrimitiveSet.Entry<P> getPrimary()
public List<PrimitiveSet.Entry<P>> getRawPrimitives() throws GeneralSecurityException
GeneralSecurityExceptionpublic List<PrimitiveSet.Entry<P>> getPrimitive(byte[] identifier) throws GeneralSecurityException
identifier.GeneralSecurityExceptionpublic Collection<List<PrimitiveSet.Entry<P>>> getAll() throws GeneralSecurityException
GeneralSecurityExceptionprotected static <P> PrimitiveSet<P> newPrimitiveSet()
protected List<PrimitiveSet.Entry<P>> getPrimitive(Keyset.Key key) throws GeneralSecurityException
key.GeneralSecurityExceptionprotected void setPrimary(PrimitiveSet.Entry<P> primary)
primary as the primary one.protected PrimitiveSet.Entry<P> addPrimitive(P primitive, Keyset.Key key) throws GeneralSecurityException
GeneralSecurityException