stream + compress + crypt a backup

Hi folks.

I’m making a incremental backup per month, and in the end of the month I want to stream, compress and crypt this folder. I was doing this way:


innobackupex --user="${USER}" --password="${PASS}" --stream=xbstream --compress "${BASE_DIR}" -encrypt="${CRYPT_ALG}" --encrypt-key-file="${BASE_DIR}"/key > /vagrant/backup.xbstream

Everything seems to work, but when I want prepare it:


xbstream -x -C /dir/backup < backup.xbstream
innobackupex --user="${USER}" --password="${PASS}" --decompress --decrypt="${CRYPT_ALG}" --encrypt-key-file="${BASE_DIR}"/key /dir/backup

a error occurred:


xb_stream_read_chunk(): wrong chunk magic at offset...

Searching I found this: [URL=“Bug #1184830 “Xtrabackup fails with “xtrabackup_55: Error writin...” : Bugs : Percona XtraBackup moved to https://jira.percona.com/projects/PXB”]https://bugs.launchpad.net/percona-x...p/+bug/1184830[/URL], that said to decrypt first. But how? If I run the second command first, It ask for a directory, not a file (backup.xbstream).

Someone can help me?
Thanks and sorry by the poor English