I'm trying to create a self-extracting encrypted archive. Here's code that doesn't work for me:
openssl enc -aes-256-cfb -salt -d -a | tar -x -j <<EOF
U2FsdGVkX19f7pGFSqDXJSREp/oDxJD0oii/FYvJlJpO8fB5ttZ/Qc8vSwIOS2y0
QUlWLocow4S1YWf86615Ji3n16RLvhOIRiy9S8DNGXl9C6ea1FYDdiuy2lA75lME
...
8yQIpRng/gXItWlaGJapqW9z2wx7y2im/lPGM8UrwZN9uY3DuRx3XbpMY5yuRWU0
oArQEvKxBAP/bB689j4P291Oauw1E8++na9phkEUXJY=
EOF
output:
enter aes-256-cfb decryption password:tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
embedded base64 data should be decrypted using openssl and its output should be piped into tar. openssl should be able to ask user for a password. If I remove tar pipeline:
openssl enc -aes-256-cfb -salt -d -a >outfile <<EOF
...
then everything works fine. Therefore I assume that openssl can handle password prompt and input from the terminal without interfering with stdin/stdout (probably prompt goes into stderr and password reading is implemented using some tty magic).
I managed to solve this task with the following construction:
{ openssl enc -aes-256-cfb -salt -d -a | tar -x -j; } <<EOF
...
but I don't understand what's wrong with the first script.