A simple file encryptor in Rust (password-based-encryption using argon2id, aes-gcm)
usage: file_encryptor enc/dec input_file output_file
A master key is derived from user's password and randomly generated salt using secure argon2id password hashing algorithm.
A randomly generated data_key is used to encrypt the input file using aes-gcm authenticated encryption algorithm.
The data_key itself is encrypted using master key and aes-gcm algorithm and stored with the encrypted file.
The data structure of an encrypted file:
- salt: 16 bytes
- nonce1: 12 bytes
- encrypted data_key: 32 bytes
- nonce2: 12 bytes
- encrypted file data