I first generate a keyfile with openssl rand -hex 64 -out keyfile
.
I then encrypt the file with openssl enc -aes-256-cbc -salt -in large_file.zip -out large_encrypted.bin -pass file:./keyfile
.
I am encrypting files sized anywhere from a few bytes to 1TB. I will be using this in a simple bash script.
- Is this secure in 2021? Should I use a different cipher?
- Can any metadata leak from the encrypted file?
- Should/can the keyfile be larger than 64 bytes?
- Should I create new keyfiles for each file I encrypt?
- Is there a minimum/maximum file size this can encrypt? Do different file sizes affect security?
- Is this considered "rolling my own crypto" (which I know is widely discouraged)?
age -p -o output.age input.txt
would encryptinput.txt
into a fileoutput.txt
and print the passphrase it used. You could also pass in your own passphrase, but I recommend against this. If you want to encrypt lots of files, use its SSH key options. – SAI Peregrinus Jun 12 '21 at 16:12