Skip to content

Encryption

Base class for Encryption scheme.

#include <Encryption.hpp>

Inherited by AESEncryption, ECDHEncryption< PolicyType >

Public Functions

Name
virtual ~Encryption()
Virtual destructor to prevent memory leakage.
virtual std::vector< std::uint8_t > EncryptData(std::vector< std::uint8_t > data, std::vector< std::uint8_t > key_data) =0
Interface function to Encrypt data.
virtual std::vector< std::uint8_t > DecryptData(std::vector< std::uint8_t > data, std::vector< std::uint8_t > key_data) =0
Interface function to Decrypt data.
virtual bool CheckEqual(const Encryption & lhs, const Encryption & rhs) const =0
Interface function to check if two Encryption instances are equal.
bool operator==(const Encryption & other) const
Overloads equality operator to CheckEqual.

Public Functions Documentation

function ~Encryption

inline virtual ~Encryption()

Virtual destructor to prevent memory leakage.

function EncryptData

virtual std::vector< std::uint8_t > EncryptData(
    std::vector< std::uint8_t > data,
    std::vector< std::uint8_t > key_data
) =0

Interface function to Encrypt data.

Parameters:

  • data The data do be encrypted
  • key_data The possible key to be used to encrypt

Return: Encrypted data vector

Reimplemented by: AESEncryption::EncryptData, ECDHEncryption::EncryptData

function DecryptData

virtual std::vector< std::uint8_t > DecryptData(
    std::vector< std::uint8_t > data,
    std::vector< std::uint8_t > key_data
) =0

Interface function to Decrypt data.

Parameters:

  • data The data to be decrypted
  • key_data The possible key to be used to decrypt

Return: Decrypted data vector

Reimplemented by: AESEncryption::DecryptData, ECDHEncryption::DecryptData

function CheckEqual

virtual bool CheckEqual(
    const Encryption & lhs,
    const Encryption & rhs
) const =0

Interface function to check if two Encryption instances are equal.

Parameters:

Return: true if equal, false otherwise

Reimplemented by: AESEncryption::CheckEqual, ECDHEncryption::CheckEqual

function operator==

inline bool operator==(
    const Encryption & other
) const

Overloads equality operator to CheckEqual.

Parameters:

  • other The instance to be compared

Return: true if equal, false otherwise


Updated on 2026-03-04 at 13:10:44 -0800