Simple encrypt and decrypt folder

Hi,
I have test directory with one file inside test.txt and I want to encrypt it and compress

Encrypt and compress command below:

tar cfz - test | openssl enc -aes-256-cbc -a -k test -salt > test.tar.gz

It's creating file but i can't decrypt it.
How unpack it in one command ?
 
encrypt:
tar cfz - test | openssl enc -aes-256-cbc -e -a -k test -salt > test.tar.gz

decrypt:
openssl enc -d -aes-256-cbc -a -k test -in test.tar.gz | tar zxf -

decrypt to folder
openssl enc -d -aes-256-cbc -a -k test -in test.tar.gz | tar zxf - -C test2

decrypt to folder and remove the specified number of leading path
openssl enc -d -aes-256-cbc -a -k test -in test.tar.gz | tar vzxf - -C test2 --strip-components 1
 
Back
Top