llarp::sodium::CryptoLibSodium

Inherits from llarp::Crypto

Public Functions

Name
CryptoLibSodium()
~CryptoLibSodium() override =default
virtual std::optional< AlignedBuffer< 32 > > maybe_decrypt_name(std::string_view ciphertext, SymmNonce nounce, std::string_view name) override
decrypt cipherText given the key generated from name
virtual bool xchacha20(const llarp_buffer_t & , const SharedSecret & , const TunnelNonce & ) override
xchacha symmetric cipher
virtual bool xchacha20_alt(const llarp_buffer_t & , const llarp_buffer_t & , const SharedSecret & , const byte_t * ) override
xchacha symmetric cipher (multibuffer)
virtual bool dh_client(SharedSecret & , const PubKey & , const SecretKey & , const TunnelNonce & ) override
path dh creator's side
virtual bool dh_server(SharedSecret & , const PubKey & , const SecretKey & , const TunnelNonce & ) override
path dh relay side
virtual bool transport_dh_client(SharedSecret & , const PubKey & , const SecretKey & , const TunnelNonce & ) override
transport dh client side
virtual bool transport_dh_server(SharedSecret & , const PubKey & , const SecretKey & , const TunnelNonce & ) override
transport dh server side
virtual bool shorthash(ShortHash & , const llarp_buffer_t & ) override
blake2b 256 bit
virtual bool hmac(byte_t * , const llarp_buffer_t & , const SharedSecret & ) override
blake2s 256 bit hmac
virtual bool sign(Signature & , const SecretKey & , const llarp_buffer_t & ) override
ed25519 sign
virtual bool sign(Signature & , const PrivateKey & , const llarp_buffer_t & ) override
ed25519 sign (custom with derived keys)
virtual bool verify(const PubKey & , const llarp_buffer_t & , const Signature & ) override
ed25519 verify
virtual bool derive_subkey(PubKey & derived, const PubKey & root, uint64_t key_n, const AlignedBuffer< 32 > * hash =nullptr) override
derive sub keys for public keys.
virtual bool derive_subkey_private(PrivateKey & derived, const SecretKey & root, uint64_t key_n, const AlignedBuffer< 32 > * hash =nullptr) override
derive sub keys for private keys.
virtual bool seed_to_secretkey(llarp::SecretKey & , const llarp::IdentitySecret & ) override
seed to secretkey
virtual void randomize(const llarp_buffer_t & ) override
randomize buffer
virtual void randbytes(byte_t * , size_t ) override
randomizer memory
virtual void identity_keygen(SecretKey & ) override
generate signing keypair
virtual void encryption_keygen(SecretKey & ) override
generate encryption keypair
virtual void pqe_keygen(PQKeyPair & ) override
generate post quantum encrytion key
virtual bool pqe_decrypt(const PQCipherBlock & , SharedSecret & , const byte_t * ) override
post quantum decrypt (buffer, sharedkey_dst, sec)
virtual bool pqe_encrypt(PQCipherBlock & , SharedSecret & , const PQPubKey & ) override
post quantum encrypt (buffer, sharedkey_dst, pub)
virtual bool check_identity_privkey(const SecretKey & ) override
virtual bool check_passwd_hash(std::string pwhash, std::string challenge) override
check if a password hash string matches the challenge

Additional inherited members

Public Functions inherited from llarp::Crypto

Name
virtual ~Crypto() =0

Public Functions Documentation

function CryptoLibSodium

CryptoLibSodium()

function ~CryptoLibSodium

~CryptoLibSodium() override =default

function maybe_decrypt_name

virtual std::optional< AlignedBuffer< 32 > > maybe_decrypt_name(
    std::string_view ciphertext,
    SymmNonce nounce,
    std::string_view name
) override

decrypt cipherText given the key generated from name

Reimplements: llarp::Crypto::maybe_decrypt_name

function xchacha20

virtual bool xchacha20(
    const llarp_buffer_t & ,
    const SharedSecret & ,
    const TunnelNonce & 
) override

xchacha symmetric cipher

Reimplements: llarp::Crypto::xchacha20

function xchacha20_alt

virtual bool xchacha20_alt(
    const llarp_buffer_t & ,
    const llarp_buffer_t & ,
    const SharedSecret & ,
    const byte_t * 
) override

xchacha symmetric cipher (multibuffer)

Reimplements: llarp::Crypto::xchacha20_alt

function dh_client

virtual bool dh_client(
    SharedSecret & ,
    const PubKey & ,
    const SecretKey & ,
    const TunnelNonce & 
) override

path dh creator's side

Reimplements: llarp::Crypto::dh_client

function dh_server

virtual bool dh_server(
    SharedSecret & ,
    const PubKey & ,
    const SecretKey & ,
    const TunnelNonce & 
) override

path dh relay side

Reimplements: llarp::Crypto::dh_server

function transport_dh_client

virtual bool transport_dh_client(
    SharedSecret & ,
    const PubKey & ,
    const SecretKey & ,
    const TunnelNonce & 
) override

transport dh client side

Reimplements: llarp::Crypto::transport_dh_client

function transport_dh_server

virtual bool transport_dh_server(
    SharedSecret & ,
    const PubKey & ,
    const SecretKey & ,
    const TunnelNonce & 
) override

transport dh server side

Reimplements: llarp::Crypto::transport_dh_server

function shorthash

virtual bool shorthash(
    ShortHash & ,
    const llarp_buffer_t & 
) override

blake2b 256 bit

Reimplements: llarp::Crypto::shorthash

function hmac

virtual bool hmac(
    byte_t * ,
    const llarp_buffer_t & ,
    const SharedSecret & 
) override

blake2s 256 bit hmac

Reimplements: llarp::Crypto::hmac

function sign

virtual bool sign(
    Signature & ,
    const SecretKey & ,
    const llarp_buffer_t & 
) override

ed25519 sign

Reimplements: llarp::Crypto::sign

function sign

virtual bool sign(
    Signature & ,
    const PrivateKey & ,
    const llarp_buffer_t & 
) override

ed25519 sign (custom with derived keys)

Reimplements: llarp::Crypto::sign

function verify

virtual bool verify(
    const PubKey & ,
    const llarp_buffer_t & ,
    const Signature & 
) override

ed25519 verify

Reimplements: llarp::Crypto::verify

function derive_subkey

virtual bool derive_subkey(
    PubKey & derived,
    const PubKey & root,
    uint64_t key_n,
    const AlignedBuffer< 32 > * hash =nullptr
) override

derive sub keys for public keys.

Reimplements: llarp::Crypto::derive_subkey

hash is really only intended for testing and overrides key_n if given.

function derive_subkey_private

virtual bool derive_subkey_private(
    PrivateKey & derived,
    const SecretKey & root,
    uint64_t key_n,
    const AlignedBuffer< 32 > * hash =nullptr
) override

derive sub keys for private keys.

Reimplements: llarp::Crypto::derive_subkey_private

hash is really only intended for testing and overrides key_n if given.

function seed_to_secretkey

virtual bool seed_to_secretkey(
    llarp::SecretKey & ,
    const llarp::IdentitySecret & 
) override

seed to secretkey

Reimplements: llarp::Crypto::seed_to_secretkey

function randomize

virtual void randomize(
    const llarp_buffer_t & 
) override

randomize buffer

Reimplements: llarp::Crypto::randomize

function randbytes

virtual void randbytes(
    byte_t * ,
    size_t 
) override

randomizer memory

Reimplements: llarp::Crypto::randbytes

function identity_keygen

virtual void identity_keygen(
    SecretKey & 
) override

generate signing keypair

Reimplements: llarp::Crypto::identity_keygen

function encryption_keygen

virtual void encryption_keygen(
    SecretKey & 
) override

generate encryption keypair

Reimplements: llarp::Crypto::encryption_keygen

function pqe_keygen

virtual void pqe_keygen(
    PQKeyPair & 
) override

generate post quantum encrytion key

Reimplements: llarp::Crypto::pqe_keygen

function pqe_decrypt

virtual bool pqe_decrypt(
    const PQCipherBlock & ,
    SharedSecret & ,
    const byte_t * 
) override

post quantum decrypt (buffer, sharedkey_dst, sec)

Reimplements: llarp::Crypto::pqe_decrypt

function pqe_encrypt

virtual bool pqe_encrypt(
    PQCipherBlock & ,
    SharedSecret & ,
    const PQPubKey & 
) override

post quantum encrypt (buffer, sharedkey_dst, pub)

Reimplements: llarp::Crypto::pqe_encrypt

function check_identity_privkey

virtual bool check_identity_privkey(
    const SecretKey & 
) override

Reimplements: llarp::Crypto::check_identity_privkey

function check_passwd_hash

virtual bool check_passwd_hash(
    std::string pwhash,
    std::string challenge
) override

check if a password hash string matches the challenge

Reimplements: llarp::Crypto::check_passwd_hash


Updated on 2026-01-10 at 22:49:45 +0000