ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
known_hosts.h
Go to the documentation of this file.
1#pragma once
2
39
41#include <stdint.h>
42#include "../common.h"
43#include <stdbool.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
53
96asciichat_error_t check_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE]);
97
102 bool *has_expected_key);
103
137asciichat_error_t check_known_host_no_identity(const char *server_ip, uint16_t port);
138
140
145
176asciichat_error_t add_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE]);
177
201asciichat_error_t remove_known_host(const char *server_ip, uint16_t port);
202
225const char *get_known_hosts_path(void);
226
228
233
270bool display_mitm_warning(const char *server_ip, uint16_t port, const uint8_t expected_key[ED25519_PUBLIC_KEY_SIZE], const uint8_t received_key[ED25519_PUBLIC_KEY_SIZE]);
271
298bool prompt_unknown_host(const char *server_ip, uint16_t port, const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE]);
299
329bool prompt_unknown_host_no_identity(const char *server_ip, uint16_t port);
330
332
337
364
366
371
386void known_hosts_destroy(void);
387
388#ifdef __cplusplus
389}
390#endif
391
unsigned short uint16_t
unsigned char uint8_t
bool prompt_unknown_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])
Interactive prompt for unknown host - returns true if user wants to add, false to abort.
const char * get_known_hosts_path(void)
Get the path to the known_hosts file.
Definition known_hosts.c:59
asciichat_error_t check_known_host_with_key(const char *server_ip, uint16_t port, const uint8_t server_key[32], uint8_t expected_key[32], bool *has_expected_key)
bool prompt_unknown_host_no_identity(const char *server_ip, uint16_t port)
Interactive prompt for unknown host without identity key - returns true if user wants to continue,...
asciichat_error_t check_known_host_no_identity(const char *server_ip, uint16_t port)
Check known_hosts for servers without identity key (no-identity entries).
void known_hosts_destroy(void)
Cleanup function to free cached known_hosts path.
asciichat_error_t add_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])
Add server to known_hosts.
asciichat_error_t remove_known_host(const char *server_ip, uint16_t port)
Remove server from known_hosts.
bool display_mitm_warning(const char *server_ip, uint16_t port, const uint8_t expected_key[32], const uint8_t received_key[32])
Display MITM warning with key comparison and prompt user for confirmation.
void compute_key_fingerprint(const uint8_t key[32], char fingerprint[(32 *2+1)])
Compute SHA256 fingerprint of Ed25519 key for display.
asciichat_error_t check_known_host(const char *server_ip, uint16_t port, const uint8_t server_key[32])
Check if server key is in known_hosts.
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
⚙️ Common definitions, error codes, macros, and types shared throughout the application
#define ED25519_PUBLIC_KEY_SIZE
Ed25519 public key size in bytes.
Definition sizes.h:38
#define HEX_STRING_SIZE_32
Hex string size for 32-byte values (64 hex chars + null terminator).
Definition sizes.h:163