I am planning to use Openssl to encrypt our weekly offsite backups using a keyfile (symmetrical encryption) and after some research I found the following GnuPGP command:
base64 -w0 <keyfile.jpg | gpg --symmetric --passphrase-fd -0 backup.tar.gz
However this generates the following error:
gpg: Warning: using insecure memory!
gpg: Fatal: out of core in secure memory while allocating 32800 bytes
Because of that I tried using OpenSSl and have now this command:
pass=$(sha256sum keyfile.jpg | awk {'print $1'})
openssl aes-256-cbc -md sha512 -salt -a -e -in backup.tar.gz -out encrypted.tar.gz.aes -pass pass:$pass
pass=""
Is that considered to be a secure method for file encryption or was GnuPGP the better option?