few crypto additions

This commit is contained in:
2025-07-25 16:04:48 +02:00
parent 3e736aaf45
commit 3e4f722b12
7 changed files with 416 additions and 7 deletions
+11 -2
View File
@@ -13,13 +13,22 @@ fn main() -> std::io::Result<()> {
.expect("Failed to bind to any available port"),
);
let server_key_pear: pea_2_pea::shared::crypto::KeyPair =
pea_2_pea::shared::crypto::generate_rsa_key_pair();
let mut buf: [u8; pea_2_pea::BUFFER_SIZE] = [0; pea_2_pea::BUFFER_SIZE];
smol::block_on(async {
loop {
match socket.recv_from(&mut buf) {
Ok((data_length, src)) => {
smol::spawn(net::handle_request(buf, socket.clone(), src, data_length))
.detach();
smol::spawn(net::handle_request(
buf,
socket.clone(),
src,
data_length,
server_key_pear.clone(),
))
.detach();
}
Err(e) => {
eprintln!("Error receiving data: {}", e);