Asylo
Public Member Functions | Static Public Member Functions | List of all members
asylo::NonceGenerator< Size > Class Template Referenceabstract

Defines a nonce-generator interface. More...

#include <nonce_generator.h>

Public Member Functions

 NonceGenerator ()=default
 
virtual ~NonceGenerator ()=default
 
virtual Status NextNonce (const std::vector< uint8_t > &key_id, UnsafeBytes< Size > *nonce)=0
 Generates the next nonce. More...
 
virtual bool uses_key_id ()
 Indicates whether nonce generator utilizes the key_id input of the NextNonce() method to maintain key-id-specific nonce state. More...
 

Static Public Member Functions

static constexpr size_t nonce_size ()
 Gets the size of the nonces generated by this nonce generator. More...
 

Detailed Description

template<size_t Size>
class asylo::NonceGenerator< Size >

Defines a nonce-generator interface.

The template parameter Size determines the size of the nonces produced by this generator.

Constructor & Destructor Documentation

◆ NonceGenerator()

template<size_t Size>
asylo::NonceGenerator< Size >::NonceGenerator ( )
default

◆ ~NonceGenerator()

template<size_t Size>
virtual asylo::NonceGenerator< Size >::~NonceGenerator ( )
virtualdefault

Member Function Documentation

◆ NextNonce()

template<size_t Size>
virtual Status asylo::NonceGenerator< Size >::NextNonce ( const std::vector< uint8_t > &  key_id,
UnsafeBytes< Size > *  nonce 
)
pure virtual

Generates the next nonce.

Generates the next nonce and writes it to nonce. The nonce generator may optionally use the key_id parameter to select a key_id-specific nonce. There is, however, no guarantee that the nonce-generator implementation will handle the key_id input as a sensitive secret. Consequently, users of the nonce-generator interface must never pass sensitive keys directly as key identifiers. Instead, a key_id must be generated from key using a one-way hash function.

Parameters
key_idKey identifier of the key that will be used with the nonce.
[out]nonceThe generated nonce.
Returns
A non-OK Status if an error is encountered.

◆ nonce_size()

template<size_t Size>
static constexpr size_t asylo::NonceGenerator< Size >::nonce_size ( )
inlinestatic

Gets the size of the nonces generated by this nonce generator.

Returns
Size of the nonces generated by this nonce generator.

◆ uses_key_id()

template<size_t Size>
virtual bool asylo::NonceGenerator< Size >::uses_key_id ( )
inlinevirtual

Indicates whether nonce generator utilizes the key_id input of the NextNonce() method to maintain key-id-specific nonce state.

Returns
True if the nonce generator utilizes the key_id input of the NextNonce() method to maintain key-id-specific nonce state.

The documentation for this class was generated from the following file: