Armored cleartext PGP, quick shareable encryption

After running a lot of services, I started realizing how much cleartext (not really, ssl irc) passwords I was sending to my friends, some of them have blowfish encryption in their clients, but there's always some trouble.

Using gpg and writing a small wrapper solved it.

#!/bin/sh

[ $# -lt 1 -o $# -gt 2 ] && {
    echo usage: `basename $0` '<recipient>' '[file]' 1>&2
    exit 0
}

[ $# -eq 1 ] && {
    echo reading from stdin, exit with '^D'
    FILE=-
}

gpg -ae -o- -r $1 $FILE | curl -sLT- https://p.iotek.org

If the command succeeds, you can share the link and the person on the other end can run;

curl -sL "$LINK" | gpg -d

The output should look something like this;

You need a passphrase to unlock the secret key for
user: "Bob (d_dude) Robertson"
4096-bit RSA key, ID DEADCA7, create 1993-04-01 (main key ID DEADBEEF)

Enter passphrase:

After unlocking your pgp key, it'll output the encrypted data on stdout.