A tool to encrypt and decrypt files. This project has been developed as part of a module at my university.
filecrypt --help
To encrypt the file secret.txt, run the following command:
filecrypt secret.txt
This will result in 3 files:
- The encrypted file secret.txt.bin
- A key file secret.txt.bin.key.yaml
- A metadata file secret.txt.bin.meta.yaml
The actual data is contained in secret.txt.bin. To decrypt secret.txt.bin, the key contained in secret.txt.bin.key.yaml is needed. The file secret.txt.bin.meta.yaml contains all the other necessary parameters to decrypt the file.
In order to decrypt the file secret.txt.bin, use the following command:
filecrypt secret.txt.bin --decrypt
The result is the decrypted file decrypted_secret.txt. This command expects the files secret.txt.bin.key.yaml and secret.txt.bin.meta.yaml to be present. If your key file and metadata file have different names, you have to specify them explicitly:
filecrypt
secret.txt.bin
--decrypt
--key-file=secret.txt.bin.key.yaml
--metadata=secret.txt.bin.meta.yaml
To encrypt secret.txt using a password, run the following command:
filecrypt secret.txt --password
You will be asked for a password which you need to enter. If you want to specify the password via the command line arguments, that is possible as well:
filecrypt secret.txt --password=supersecret
To decrypt the resulting secret.txt.bin, you need to enter the password again.
filecrypt secret.txt --decrypt --password
If you want to verify that a file has not been corrupted, use the --verification
option when encrypting.
filecrypt secret.txt --verification
As long as you keep the metadata file, the file contents will be verified automatically on decryption.
filecrypt secret.txt --decrypt
If you want to sign the file contents, use the --signature
option when encrypting.
filecrypt secret.txt --signature
As long as you keep the metadata file, the signature will be verified automatically on decryption.
filecrypt secret.txt --decrypt