I need to encrypt and be able to decrypt files with openssl
, currently I do this simply with:
openssl enc -aes-256-cbc -salt -in "$input_filename" -out "$output_filename"
and the decryption with:
openssl enc -aes-256-cbc -d -salt -in "$input_filename" -out "$output_filename"
But with large files, I would like to see progress.
I tried different variations of the following (decryption):
pv "$input_filename" | openssl enc -aes-256-cbc -d -salt | pv > "$output_filename"
But this fails to ask me for a password. I am unsure as to how to go about it?
EDIT1:
I found this tar
over openssl
:
https://stackoverflow.com/a/24704457/1997354
While it could be extremely helpful, I don't get it much.
EDIT2:
Regarding the named pipe:
It almost works. Except for the blinking progress, which I can't show you obviously and the final result looking like this:
enter aes-256-cbc decryption password:
1.25GiB 0:00:16 [75.9MiB/s] [==============================================================================================================================================================================================>] 100%
1.25GiB 0:00:10 [ 126MiB/s] [ <=> ]
Best Answer
You should try
From the Manual:
which is exactly your case. If you need to see the progress bar, for the reason clearly explained by Weijun Zhou in a comment below, you can reverse the order of the commands in the pipe: