CCF
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ccf::kv::TxEncryptor< T, S > Class Template Reference

#include <encryptor.h>

Inherits ccf::kv::AbstractTxEncryptor.

Public Member Functions

 TxEncryptor (const std::shared_ptr< T > &secrets)
 
size_t get_header_length () override
 
uint64_t get_term (const uint8_t *data, size_t size) override
 
bool encrypt (const std::vector< uint8_t > &plain, const std::vector< uint8_t > &additional_data, std::vector< uint8_t > &serialised_header, std::vector< uint8_t > &cipher, const TxID &tx_id, EntryType entry_type=EntryType::WriteSet, bool historical_hint=false) override
 
bool decrypt (const std::vector< uint8_t > &cipher, const std::vector< uint8_t > &additional_data, const std::vector< uint8_t > &serialised_header, std::vector< uint8_t > &plain, Version version, Term &term, bool historical_hint=false) override
 
ccf::crypto::HashBytes get_commit_nonce (const TxID &tx_id, bool historical_hint=false) override
 
void rollback (Version version) override
 
- Public Member Functions inherited from ccf::kv::AbstractTxEncryptor
virtual ~AbstractTxEncryptor ()
 

Constructor & Destructor Documentation

◆ TxEncryptor()

template<typename T , typename S >
ccf::kv::TxEncryptor< T, S >::TxEncryptor ( const std::shared_ptr< T > &  secrets)
inline

Member Function Documentation

◆ decrypt()

template<typename T , typename S >
bool ccf::kv::TxEncryptor< T, S >::decrypt ( const std::vector< uint8_t > &  cipher,
const std::vector< uint8_t > &  additional_data,
const std::vector< uint8_t > &  serialised_header,
std::vector< uint8_t > &  plain,
Version  version,
Term term,
bool  historical_hint = false 
)
inlineoverridevirtual

Decrypt cipher and return plaintext.

Parameters
[in]cipherCipher to decrypt
[in]additional_dataAdditional data to verify tag
[in]serialised_headerSerialised header (iv + tag)
[out]plainDecrypted plaintext
[in]versionVersion used to retrieve the corresponding encryption key
[out]termTerm contained in header
[in]historical_hintIf true, considers all ledger secrets for decryption. Otherwise, try to use the latest used secret (defaults to false)
Returns
Boolean status indicating success of decryption.

Implements ccf::kv::AbstractTxEncryptor.

◆ encrypt()

template<typename T , typename S >
bool ccf::kv::TxEncryptor< T, S >::encrypt ( const std::vector< uint8_t > &  plain,
const std::vector< uint8_t > &  additional_data,
std::vector< uint8_t > &  serialised_header,
std::vector< uint8_t > &  cipher,
const TxID tx_id,
EntryType  entry_type = EntryType::WriteSet,
bool  historical_hint = false 
)
inlineoverridevirtual

Encrypt data and return serialised GCM header and cipher.

Parameters
[in]plainPlaintext to encrypt
[in]additional_dataAdditional data to tag
[out]serialised_headerSerialised header (iv + tag)
[out]cipherEncrypted ciphertext encryption key
[in]tx_idTransaction ID (version + term) corresponding with the plaintext
[in]entry_typeIndicates the type of the entry to avoid IV re-use
[in]historical_hintIf true, considers all ledger secrets for encryption. Otherwise, try to use the latest used secret (defaults to false)
Returns
Boolean status indicating success of encryption.

Implements ccf::kv::AbstractTxEncryptor.

◆ get_commit_nonce()

template<typename T , typename S >
ccf::crypto::HashBytes ccf::kv::TxEncryptor< T, S >::get_commit_nonce ( const TxID tx_id,
bool  historical_hint = false 
)
inlineoverridevirtual

◆ get_header_length()

template<typename T , typename S >
size_t ccf::kv::TxEncryptor< T, S >::get_header_length ( )
inlineoverridevirtual

◆ get_term()

template<typename T , typename S >
uint64_t ccf::kv::TxEncryptor< T, S >::get_term ( const uint8_t *  data,
size_t  size 
)
inlineoverridevirtual

◆ rollback()

template<typename T , typename S >
void ccf::kv::TxEncryptor< T, S >::rollback ( Version  version)
inlineoverridevirtual

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