ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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
49
92asciichat_error_t check_known_host(const char *server_ip, uint16_t port,
93 const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE]);
94
99 const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE],
100 uint8_t expected_key[ED25519_PUBLIC_KEY_SIZE], bool *has_expected_key);
101
135asciichat_error_t check_known_host_no_identity(const char *server_ip, uint16_t port);
136
138
143
174asciichat_error_t add_known_host(const char *server_ip, uint16_t port,
175 const uint8_t server_key[ED25519_PUBLIC_KEY_SIZE]);
176
200asciichat_error_t remove_known_host(const char *server_ip, uint16_t port);
201
224const char *get_known_hosts_path(void);
225
227
232
269bool display_mitm_warning(const char *server_ip, uint16_t port, const uint8_t expected_key[ED25519_PUBLIC_KEY_SIZE],
270 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
⚙️ Common definitions, error codes, macros, and types shared throughout the application
unsigned short uint16_t
Definition common.h:61
unsigned char uint8_t
Definition common.h:60
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:57
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:44
#define ED25519_PUBLIC_KEY_SIZE
Ed25519 public key size in bytes.
Definition sizes.h:33
#define HEX_STRING_SIZE_32
Hex string size for 32-byte values (64 hex chars + null terminator).
Definition sizes.h:154