gpg

Debian apt-get errors about gpg key

If during your apt activity you are getting some errors like this:  

W: GPG error: http://ftp.us.debian.org etch Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B

Try to add the key from keyserver specifying the key id and you should be ok

~# gpg --keyserver pgpkeys.mit.edu --recv-key  9AA38DCD55BE302B ~# gpg -a --export 9AA38DCD55BE302B | apt-key add -

 

Quick data pipeline for encryption and decryption

In the need for a quick pipeline to encrypt and decrypt data, gpg can be quite handy, for example it can be used in this way to encrypt  some backup before transferring it to a third part hosted  storage:

cat backupfile.tgz | gpg -c --cipher-algo=BLOWFISH > backupfile.tgz.gpg

(you’ll be asked for the Passphrase to use for encryption)and for decryption:

cat backupfile.tgz.gpg |gpg -d --cipher-algo=BLOWFISH > backupfile.tgz

(you’ll be obviously asked for the Passphrase again, don’t forget it and save it in a safe place!)To use it inside a script (batch process) the useful --passphrase switch can be employed:

cat backupfile.tgz | gpg -c –cipher-algo=BLOWFISH --passphrase abcdefghi1234567890 > backupfile.tgz.gpg

in this case, do not forget to set 700 the file for avoiding unwanted reading…