write all to encrypted file instead
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
// DLL decryption metadata
|
||||
unsigned char decryption_metadata_bin[] = {
|
||||
0x4d, 0x99, 0x06, 0x07, 0xca, 0x4a, 0x94, 0xf5, 0xec, 0x05, 0xa4, 0x0a,
|
||||
0xea, 0xdf, 0x7a, 0x39, 0xb9, 0x7e, 0x8c, 0x28, 0x4d, 0x2d, 0xe4, 0x75,
|
||||
0x42, 0xdb, 0x54, 0x06, 0x7d, 0xe3, 0x99, 0x74, 0x66, 0x5e, 0xba, 0x8b,
|
||||
0xee, 0x59, 0x70, 0x09, 0x88, 0xe8, 0xc7, 0x65, 0xac, 0xdc, 0x81, 0x8c,
|
||||
0x10, 0xba, 0x7e, 0x00
|
||||
};
|
||||
unsigned int decryption_metadata_bin_len = 52;
|
||||
+692102
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
// Decryption metadata
|
||||
unsigned char decryption_metadata_bin[] = {
|
||||
0xde, 0x7f, 0x54, 0x15, 0xfd, 0x5b, 0xde, 0x4f, 0x01, 0x48, 0x2f, 0x8c,
|
||||
0xa7, 0xbf, 0x3c, 0xc3, 0xce, 0x9a, 0xe4, 0x08, 0x8e, 0x0c, 0x1d, 0x2c,
|
||||
0x0c, 0xe9, 0x9e, 0x99, 0xab, 0xb2, 0x9b, 0xbc, 0xa0, 0x44, 0x1a, 0x8b,
|
||||
0x2d, 0xe3, 0x7c, 0xd0, 0xce, 0xd1, 0x0a, 0xfe, 0x8d, 0x32, 0x21, 0x87,
|
||||
0x10, 0x30, 0x16, 0x00
|
||||
};
|
||||
unsigned int decryption_metadata_bin_len = 52;
|
||||
+121179
File diff suppressed because it is too large
Load Diff
+8
-12
@@ -22,9 +22,8 @@ fn main() -> std::io::Result<()> {
|
||||
let fname = args.get(1).unwrap();
|
||||
let plaintext_bytes = read(fname).expect("Failed to read file");
|
||||
|
||||
// Create output files with consistent naming
|
||||
let mut encrypted_file = File::create("encrypted_Input.bin")?;
|
||||
let mut metadata_file = File::create("decryption_metadata.bin")?;
|
||||
// Create single output file
|
||||
let mut output_file = File::create("encrypted_dll.dll")?;
|
||||
|
||||
// Master password (in production, this should be securely provided)
|
||||
let master_password = "YourSecureMasterPassword123!"; // Change this!
|
||||
@@ -72,17 +71,14 @@ fn main() -> std::io::Result<()> {
|
||||
ciphertext.extend_from_slice(&block);
|
||||
}
|
||||
|
||||
// Write encrypted data
|
||||
encrypted_file.write_all(&ciphertext)?;
|
||||
|
||||
// Write metadata for external decryption
|
||||
metadata_file.write_all(&salt)?;
|
||||
metadata_file.write_all(&iv)?;
|
||||
metadata_file.write_all(&(ciphertext.len() as u32).to_le_bytes())?;
|
||||
// Write metadata first, then encrypted data
|
||||
output_file.write_all(&salt)?;
|
||||
output_file.write_all(&iv)?;
|
||||
output_file.write_all(&(ciphertext.len() as u32).to_le_bytes())?;
|
||||
output_file.write_all(&ciphertext)?;
|
||||
|
||||
println!("Encryption complete!");
|
||||
println!("Encrypted file: encrypted_Input.bin");
|
||||
println!("Metadata file: decryption_metadata.bin");
|
||||
println!("Encrypted DLL: encrypted_dll.dll");
|
||||
println!("Master password: {}", master_password);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user