[][src]Struct tink_core::primitiveset::PrimitiveSet

pub struct PrimitiveSet {
    pub primary: Option<Entry>,
    pub entries: HashMap<Vec<u8>, Vec<Entry>>,
}

PrimitiveSet is 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 public to allow its use in implementations of custom primitives.

Fields

primary: Option<Entry>entries: HashMap<Vec<u8>, Vec<Entry>>

Implementations

impl PrimitiveSet[src]

pub fn new() -> Self[src]

Return an empty instance of PrimitiveSet.

pub fn raw_entries(&self) -> Vec<Entry>[src]

Return all primitives in the set that have RAW prefix.

pub fn entries_for_prefix(&self, prefix: &[u8]) -> Vec<Entry>[src]

Return all primitives in the set that have the given prefix.

pub fn add(&mut self, p: Primitive, key: &Key) -> Result<Entry, TinkError>[src]

Create a new entry in the primitive set and returns a copy of the added entry.

Trait Implementations

impl Clone for PrimitiveSet[src]

impl Default for PrimitiveSet[src]

impl<P: From<Primitive>> From<PrimitiveSet> for TypedPrimitiveSet<P>[src]

Convert an untyped PrimitiveSet into a TypedPrimitiveSet. This will panic if any of the primitives are not of the correct type.

Auto Trait Implementations

impl !RefUnwindSafe for PrimitiveSet

impl !Send for PrimitiveSet

impl !Sync for PrimitiveSet

impl Unpin for PrimitiveSet

impl !UnwindSafe for PrimitiveSet

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,