Sfoglia il codice sorgente

discovery: Truncate the AES key to 128

The computed key is 20 bytes long (SHA1 checksum), but it used for AES128.
The last 4 bytes should therefore be dropped.
Paul Lietar 9 anni fa
parent
commit
2c2ff16986
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/discovery.rs

+ 1 - 1
src/discovery.rs

@@ -100,7 +100,7 @@ impl DiscoveryManager {
 
         let decrypted = {
             let mut data = vec![0u8; encrypted.len()];
-            let mut cipher = crypto::aes::ctr(crypto::aes::KeySize::KeySize128, &encryption_key, &iv);
+            let mut cipher = crypto::aes::ctr(crypto::aes::KeySize::KeySize128, &encryption_key[0..16], &iv);
             cipher.process(&encrypted, &mut data);
             String::from_utf8(data).unwrap()
         };