signature verification
This commit is contained in:
@@ -7,12 +7,12 @@ pub struct UDPMessage {
|
||||
}
|
||||
|
||||
pub struct HandshakeMessage {
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
msg_type: u8,
|
||||
length: u16,
|
||||
extensions: u32,
|
||||
name: Vec<u8>,
|
||||
signature: Vec<u8>,
|
||||
pub name: Vec<u8>,
|
||||
pub signature: Vec<u8>,
|
||||
}
|
||||
|
||||
impl UDPMessage {
|
||||
@@ -130,9 +130,9 @@ impl HandshakeMessage {
|
||||
let extensions_bytes: [u8; 4] = received_message[7..11]
|
||||
.try_into()
|
||||
.expect("Taille incorrecte");
|
||||
let name_bytes = &received_message[11..12 + msg_length as usize];
|
||||
let name_bytes = &received_message[11..(11 + msg_length - 4) as usize];
|
||||
let signature_bytes =
|
||||
&received_message[12 + msg_length as usize..(13 + msg_length + 32) as usize];
|
||||
&received_message[(11 + msg_length - 4) as usize..(11 + msg_length - 4 + 64) as usize];
|
||||
HandshakeMessage {
|
||||
id: u32::from_be_bytes(id_bytes),
|
||||
msg_type: received_message[4],
|
||||
|
||||
Reference in New Issue
Block a user