Skip to content

Commit

Permalink
discovery: Truncate the AES key to 128
Browse files Browse the repository at this point in the history
The computed key is 20 bytes long (SHA1 checksum), but it used for AES128.
The last 4 bytes should therefore be dropped.
  • Loading branch information
plietar committed Jan 2, 2016
1 parent f895616 commit 2c2ff16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down

0 comments on commit 2c2ff16

Please sign in to comment.