소스 검색

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 년 전
부모
커밋
2c2ff16986
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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()
         };