Changes to be committed:
modified: src/client.rs modified: src/server.rs
This commit is contained in:
parent
ceac4a33e9
commit
63998ddd8b
@ -139,7 +139,6 @@ pub async fn client_mode(client_config: ClientConfiguration) {
|
||||
if s_cipher.is_some() {
|
||||
let aes = Aes256Gcm::new(s_cipher.as_ref().unwrap().as_bytes().into());
|
||||
let nonce = Nonce::clone_from_slice(&wrapped_packet.nonce);
|
||||
info!("Key: {:?} / nonce: {:?}", s_cipher.as_ref().unwrap().as_bytes(), &nonce);
|
||||
match aes.decrypt(&nonce, &wrapped_packet.data[..]) {
|
||||
Ok(decrypted) => { tx.send(decrypted); },
|
||||
Err(error) => error!("Decryption error! {:?}", error)
|
||||
@ -170,7 +169,7 @@ pub async fn client_mode(client_config: ClientConfiguration) {
|
||||
if s_c.is_some() {
|
||||
let aes = Aes256Gcm::new(s_c.as_ref().unwrap().as_bytes().into());
|
||||
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
|
||||
info!("Nonce len: {:?}", &nonce.len());
|
||||
info!("Key {:?} / nonce {:?}", s_c.as_ref().unwrap().as_bytes(), &nonce.bytes());
|
||||
let ciphered_data = aes.encrypt(&nonce, &bytes[..]);
|
||||
|
||||
if let Ok(ciphered_d) = ciphered_data {
|
||||
|
@ -73,8 +73,6 @@ pub async fn server_mode(server_config: ServerConfiguration) {
|
||||
let aes = Aes256Gcm::new(&peer.shared_secret.into());
|
||||
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
|
||||
|
||||
info!("Key: {:?} / nonce: {:?}", &peer.shared_secret, &nonce);
|
||||
|
||||
let ciphered_data = aes.encrypt(&nonce, &buf[..n]);
|
||||
|
||||
if let Ok(ciphered_d) = ciphered_data {
|
||||
@ -138,7 +136,7 @@ pub async fn server_mode(server_config: ServerConfiguration) {
|
||||
1 => {
|
||||
let packet = UDPVpnPacket::deserialize(&(buf[..len].to_vec()));
|
||||
mp.values().filter(| p | p.addr == addr).for_each(|p| {
|
||||
info!("UDPeer addr == addr / {:?}", &p.shared_secret);
|
||||
info!("Key {:?} / nonce {:?}", &p.shared_secret, &packet.nonce);
|
||||
let aes = Aes256Gcm::new(&p.shared_secret.into());
|
||||
let nonce = Nonce::clone_from_slice(&packet.nonce[..]);
|
||||
match aes.decrypt(&nonce, &packet.data[..]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user