Specifications
- Encrypts a plaintext file into a ciphertext file
- Prints out the
vector
, computed mac
and salts
after generation during encryption
- Need to specify the
password
during decryption and encryption
- Secret key is generated by hashing passwords with a random salt
- Can specify between
Blowfish
and AES
algorithms
- Can specify secret key length
- Computed a Message Authentication code,
mac
to check for authentication and integrity
- Writes metadata during encryption in ciphertext file
- Reads metadata during decryption from ciphertext file
- Allows user to query metadata of an encrypted file
- Uses char arrays instead of strings for sensitive information such as the
password
- Clears the char arrays after use
General Commands
Encryption
% java FileEncryptor enc "password" plaintext.txt ciphertext.enc
% java FileEncryptor enc Blowfish "password" plaintext.txt ciphertext.enc
% java FileEncryptor enc 192 "password" plaintext.txt ciphertext.enc
% java FileEncryptor enc AES 256 "password" plaintext.txt ciphertext.enc
Decryption
% java FileEncryptor dec "password" ciphertext.enc plaintext.txt
Query Metadata
% java FileEncryptor info ciphertext.enc
Output
<---------------------------------------->
Secret Key: 4v3GURNUyxpT+wQ7V+7lnA==
Init Vector: Myg7C+La5xo7A9czkMvSlA==
Salt: FbXNYM6ofed26t/GY27/tQ==
Mac Key: XgYmnjFXo0aKTxGMc00uVHoeNYvXBTwRV5teJM8TitU=
Mac salt: 3X0+fVGznlZQtXN+4QW7aA==
Computed Mac: yiB/ldtDwyKMt4vcPfja+TC9guC+xzgoexFj+ciC6k8=
<---------------------------------------->
INFO: Encryption finished, saved at ciphertext.enc
<---------------------------------------->
Secret Key: 4v3GURNUyxpT+wQ7V+7lnA==
Init Vector: Myg7C+La5xo7A9czkMvSlA==
Salt: FbXNYM6ofed26t/GY27/tQ==
Mac Key: XgYmnjFXo0aKTxGMc00uVHoeNYvXBTwRV5teJM8TitU=
Mac salt: 3X0+fVGznlZQtXN+4QW7aA==
Computed Mac: yiB/ldtDwyKMt4vcPfja+TC9guC+xzgoexFj+ciC6k8=
Given Mac: yiB/ldtDwyKMt4vcPfja+TC9guC+xzgoexFj+ciC6k8=
<---------------------------------------->
INFO: Authentication passed, file integrity maintained
INFO: Decryption complete, open decrypted.txt