I'm using this for creating backups securely (? - is it really secure? with a good password?):
# ENCRYPT
ORIGDIR="DIRECTORYNAMEHERE"; tar cvf - "${ORIGDIR}/" 2>/dev/null | gzip -9 - 2>/dev/null | openssl aes-256-cbc -salt -out "${ORIGDIR}.tar.gz.aes"
# DECRYPT
openssl aes-256-cbc -d -salt -in "ENCDIRECTORYNAMEHERE" | tar -xz -f -
Q: But how can I do this using 7z with max compression rate?
Creating temporary files besides the only OUTPUT file is not good, because if I need to compress ~100 GByte sized files/directories on a 180 GByte FS I wouldn't have enough free space (if ex.: the compressed file would take ~60 GByte).