Skip to content

Commit

Permalink
Add RUST AES Template Decryption final
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvourd committed Oct 4, 2023
1 parent 114f165 commit 97e1d33
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Decryptors/Decryptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ use std::io::Write;
fn aes_decrypt(encrypted_data: &[u8], key: &[u8], iv: &[u8]) -> Result<Vec<u8>, ErrorStack> {
let cipher = Cipher::aes_256_cbc();
let mut decrypter = Crypter::new(cipher, Mode::Decrypt, key, Some(iv))?;
decrypter.pad(false);
let mut decrypted_data = vec![0; encrypted_data.len() + cipher.block_size()];
let mut count = decrypter.update(encrypted_data, &mut decrypted_data)?;
Expand All @@ -651,20 +650,20 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(decrypted_payload) => {
let payload_len = decrypted_payload.len();
println!("AES Decrypted Payload:\n");
print!("let %s: [u8; {}] = [", payload_len);
for (i, byte) in decrypted_payload.iter().enumerate() {
print!("{:#04x}", byte);
if i < payload_len - 1 {
print!(", ");
}
}
println!("];");
println!("];\n");
}
Err(e) => {
eprintln!("Error: {:?}", e);
}
}
Ok(())
}
`
Expand Down

0 comments on commit 97e1d33

Please sign in to comment.