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:…p/+bug/1184830, 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