30 #ifndef __ZMQ_CURVE_SERVER_HPP_INCLUDED__ 31 #define __ZMQ_CURVE_SERVER_HPP_INCLUDED__ 35 #include "platform.hpp" 37 #if defined (ZMQ_USE_TWEETNACL) 39 #elif defined (ZMQ_USE_LIBSODIUM) 43 #if crypto_box_NONCEBYTES != 24 \ 44 || crypto_box_PUBLICKEYBYTES != 32 \ 45 || crypto_box_SECRETKEYBYTES != 32 \ 46 || crypto_box_ZEROBYTES != 32 \ 47 || crypto_box_BOXZEROBYTES != 16 \ 48 || crypto_secretbox_NONCEBYTES != 24 \ 49 || crypto_secretbox_ZEROBYTES != 32 \ 50 || crypto_secretbox_BOXZEROBYTES != 16 51 # error "CURVE library not built properly" 63 class curve_server_t :
public mechanism_t
67 curve_server_t (session_base_t *session_,
68 const std::string &peer_address_,
69 const options_t &options_);
70 virtual ~curve_server_t ();
73 virtual int next_handshake_command (msg_t *msg_);
74 virtual int process_handshake_command (msg_t *msg_);
75 virtual int encode (msg_t *msg_);
76 virtual int decode (msg_t *msg_);
77 virtual int zap_msg_available ();
78 virtual status_t status ()
const;
93 session_base_t *
const session;
95 const std::string peer_address;
101 std::string status_code;
104 uint64_t cn_peer_nonce;
107 uint8_t secret_key [crypto_box_SECRETKEYBYTES];
110 uint8_t cn_public [crypto_box_PUBLICKEYBYTES];
113 uint8_t cn_secret [crypto_box_SECRETKEYBYTES];
116 uint8_t cn_client [crypto_box_PUBLICKEYBYTES];
119 uint8_t cookie_key [crypto_secretbox_KEYBYTES];
122 uint8_t cn_precom [crypto_box_BEFORENMBYTES];
124 int process_hello (msg_t *msg_);
125 int produce_welcome (msg_t *msg_);
126 int process_initiate (msg_t *msg_);
127 int produce_ready (msg_t *msg_);
128 int produce_error (msg_t *msg_)
const;
130 void send_zap_request (
const uint8_t *key);
131 int receive_and_process_zap_reply ();