Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
Mads::CurveAuth Class Reference

#include <curve.hpp>

Public Member Functions

 CurveAuth (zmq::context_t &context)
 Constructs a CurveAuth object for managing CURVE authentication.
 
 ~CurveAuth ()=default
 
void setup_auth (auth_verbose verbose=auth_verbose::off)
 Sets up ZAP authentication with the specified verbosity.
 
void fetch_public_keys (fs::path const &key_dir)
 Fetches client public keys from the specified directory.
 
void setup_curve_server (zmq::socket_t &socket, string const &key_name)
 Sets up CURVE security for a server socket.
 
void setup_curve_client (zmq::socket_t &socket, string const &client_name, string const &server_name)
 Sets up CURVE security for a client socket.
 
void setup_curve_client (zmq::socket_t &socket)
 Sets up CURVE security for a client socket using raw keys.
 
void set_key_dir (fs::path const &key_dir)
 
void set_client_public_key (string const &key)
 
string client_public_key () const
 
void set_client_secret_key (string const &key)
 
string client_secret_key () const
 
void set_server_public_key (string const &key)
 
string server_public_key () const
 

Public Attributes

vector< string > allowed_ips {}
 

Detailed Description

Definition at line 37 of file curve.hpp.

Constructor & Destructor Documentation

◆ CurveAuth()

Mads::CurveAuth::CurveAuth ( zmq::context_t &  context)
inline

Constructs a CurveAuth object for managing CURVE authentication.

Parameters
contextThe zmq::context_t to use for authentication.

Definition at line 44 of file curve.hpp.

◆ ~CurveAuth()

Mads::CurveAuth::~CurveAuth ( )
default

Member Function Documentation

◆ client_public_key()

string Mads::CurveAuth::client_public_key ( ) const
inline

Definition at line 217 of file curve.hpp.

References Mads::CurveKeypair::public_key.

◆ client_secret_key()

string Mads::CurveAuth::client_secret_key ( ) const
inline

Definition at line 225 of file curve.hpp.

References Mads::CurveKeypair::secret_key.

◆ fetch_public_keys()

void Mads::CurveAuth::fetch_public_keys ( fs::path const &  key_dir)
inline

Fetches client public keys from the specified directory.

Scans the given directory for files with .pub extension and stores the client key names (without extension) in the _client_keys member variable.

Parameters
key_dirThe directory to scan for client public keys.
Exceptions
runtime_errorif no client public keys are found.

Definition at line 78 of file curve.hpp.

◆ server_public_key()

string Mads::CurveAuth::server_public_key ( ) const
inline

Definition at line 233 of file curve.hpp.

◆ set_client_public_key()

void Mads::CurveAuth::set_client_public_key ( string const &  key)
inline

Definition at line 213 of file curve.hpp.

References Mads::CurveKeypair::public_key.

◆ set_client_secret_key()

void Mads::CurveAuth::set_client_secret_key ( string const &  key)
inline

Definition at line 221 of file curve.hpp.

References Mads::CurveKeypair::secret_key.

◆ set_key_dir()

void Mads::CurveAuth::set_key_dir ( fs::path const &  key_dir)
inline

Definition at line 206 of file curve.hpp.

◆ set_server_public_key()

void Mads::CurveAuth::set_server_public_key ( string const &  key)
inline

Definition at line 229 of file curve.hpp.

◆ setup_auth()

void Mads::CurveAuth::setup_auth ( auth_verbose  verbose = auth_verbose::off)
inline

Sets up ZAP authentication with the specified verbosity.

Also setups the allowed IP addresses for authentication, reading from the allowed_ips member variable.

Parameters
verboseWhether to enable verbose logging.

Definition at line 55 of file curve.hpp.

References Mads::ZapAuth::allow(), allowed_ips, Mads::ZapAuth::configure_domain(), Mads::on, Mads::ZapAuth::set_verbose(), and Mads::ZapAuth::start().

◆ setup_curve_client() [1/2]

void Mads::CurveAuth::setup_curve_client ( zmq::socket_t &  socket)
inline

Sets up CURVE security for a client socket using raw keys.

Configures the socket to use the provided public and secret keys.

Parameters
socketThe zmq::socket_t to secure.

Definition at line 197 of file curve.hpp.

References Mads::CurveKeypair::public_key, and Mads::CurveKeypair::secret_key.

◆ setup_curve_client() [2/2]

void Mads::CurveAuth::setup_curve_client ( zmq::socket_t &  socket,
string const &  client_name,
string const &  server_name 
)
inline

Sets up CURVE security for a client socket.

Reads the client's keypair from files and configures the socket to use the server's public key.

Parameters
socketThe zmq::socket_t to secure.
client_nameThe base name of the client key files (.key and .pub).
server_nameThe base name of the server public key file (.pub).
Exceptions
runtime_errorif key files cannot be opened or read.

Definition at line 157 of file curve.hpp.

References Mads::CurveKeypair::public_key, Mads::CurveKeypair::secret_key, and setup_curve_client().

Referenced by setup_curve_client().

◆ setup_curve_server()

void Mads::CurveAuth::setup_curve_server ( zmq::socket_t &  socket,
string const &  key_name 
)
inline

Sets up CURVE security for a server socket.

Reads the server's keypair from files and configures the authenticator to accept clients with the given public keys.

Parameters
socketThe zmq::socket_t to secure.
key_nameThe base name of the server key files (.key and .pub).
Exceptions
runtime_errorif key files cannot be opened or read.

Definition at line 104 of file curve.hpp.

References Mads::ZapAuth::configure_curve(), Mads::CurveKeypair::public_key, and Mads::CurveKeypair::secret_key.

Member Data Documentation

◆ allowed_ips

vector<string> Mads::CurveAuth::allowed_ips {}

Definition at line 239 of file curve.hpp.

Referenced by setup_auth().


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