libfilezilla
Classes | Namespaces | Functions
encryption.hpp File Reference

Functions for symmetric and asymmetric encryption. More...

#include "libfilezilla.hpp"
#include <vector>
#include <string>
Include dependency graph for encryption.hpp:

Go to the source code of this file.

Classes

class  public_key
 Represents a X25519 public key with associated salt. More...
 
class  private_key
 Represents a X25519 private key with associated salt. More...
 
class  symmetric_key
 Symmetric encryption key with associated salt. More...
 

Namespaces

 fz
 The namespace used by libfilezilla.
 

Functions

std::vector< uint8_t > encrypt (std::vector< uint8_t > const &plain, public_key const &pub, bool authenticated=true)
 Encrypt the plaintext to the given public key. More...
 
std::vector< uint8_t > encrypt (std::string_view const &plain, public_key const &pub, bool authenticated=true)
 
std::vector< uint8_t > encrypt (uint8_t const *plain, size_t size, public_key const &pub, bool authenticated=true)
 
std::vector< uint8_t > encrypt (std::vector< uint8_t > const &plain, public_key const &pub, std::vector< uint8_t > const &authenticated_data)
 
std::vector< uint8_t > encrypt (std::string_view const &plain, public_key const &pub, std::string_view const &authenticated_data)
 
std::vector< uint8_t > encrypt (uint8_t const *plain, size_t size, public_key const &pub, uint8_t const *authenticated_data, size_t authenticated_data_size)
 
std::vector< uint8_t > decrypt (std::vector< uint8_t > const &chiper, private_key const &priv, bool authenticated=true)
 Decrypt the ciphertext using the given private key. More...
 
std::vector< uint8_t > decrypt (std::string_view const &chiper, private_key const &priv, bool authenticated=true)
 
std::vector< uint8_t > decrypt (uint8_t const *cipher, size_t size, private_key const &priv, bool authenticated=true)
 
std::vector< uint8_t > decrypt (std::vector< uint8_t > const &cipher, private_key const &priv, std::vector< uint8_t > const &authenticated_data)
 
std::vector< uint8_t > decrypt (std::string_view const &cipher, private_key const &priv, std::string_view const &authenticated_data)
 
std::vector< uint8_t > decrypt (uint8_t const *cipher, size_t size, private_key const &priv, uint8_t const *authenticated_data, size_t authenticated_data_size)
 
bool operator== (symmetric_key const &lhs, symmetric_key const &rhs)
 Side-channel safe comparison.
 
bool operator!= (symmetric_key const &lhs, symmetric_key const &rhs)
 
std::vector< uint8_t > encrypt (std::vector< uint8_t > const &plain, symmetric_key const &key)
 Encrypt the plaintext using the given symmetric key. More...
 
std::vector< uint8_t > encrypt (std::string_view const &plain, symmetric_key const &key)
 
std::vector< uint8_t > encrypt (uint8_t const *plain, size_t size, symmetric_key const &key)
 
std::vector< uint8_t > encrypt (std::vector< uint8_t > const &plain, symmetric_key const &key, std::vector< uint8_t > const &authenticated_data)
 
std::vector< uint8_t > encrypt (std::string_view const &plain, symmetric_key const &key, std::string_view const &authenticated_data)
 
std::vector< uint8_t > encrypt (uint8_t const *plain, size_t size, symmetric_key const &key, uint8_t const *authenticated_data, size_t authenticated_data_size)
 
std::vector< uint8_t > decrypt (std::vector< uint8_t > const &chiper, symmetric_key const &key)
 Decrypt the ciphertext using the given symmetric key. More...
 
std::vector< uint8_t > decrypt (std::string_view const &chiper, symmetric_key const &key)
 
std::vector< uint8_t > decrypt (uint8_t const *cipher, size_t size, symmetric_key const &key)
 
std::vector< uint8_t > decrypt (std::vector< uint8_t > const &cipher, symmetric_key const &key, std::vector< uint8_t > const &authenticated_data)
 
std::vector< uint8_t > decrypt (std::string_view const &cipher, symmetric_key const &key, std::string_view const &authenticated_data)
 
std::vector< uint8_t > decrypt (uint8_t const *cipher, size_t size, symmetric_key const &key, uint8_t const *authenticated_data, size_t authenticated_data_size)
 

Detailed Description

Functions for symmetric and asymmetric encryption.

Key derivation done through PBKDF2

Asymmetric encryption scheme using X25519, see RFC 7748 for the X22519 specifications.