Open a port using netcat and redirect the messages received to a named queue. then in an infinite loop extract the message from the queue and decrypt with gpg And for sure we need to send our gpg public key to our friends And we can use TOR to expose the server as an onion service so we don't give our real ip address.
while true; do (cat mypipe > text.gpg); sleep 1; echo 'Message received:' && gpg --decrypt text.gpg ; done &
nc -l -p 50001 > mypipe &
In another scritp we can have what we need to send the message
echo "Hello world" | gpg -eas -r someones@gpgid.com | nc somefakeonionurl.onion 50001
With this very siemple solution we can send gpg/pgp key based encrypted messages to our friends or receive messages with no intermediate hosing services, then we can also have a little database to match the public keys with the hostnames to make it more accessible.
I've done this and works well. but we may need to spread the word. When I get the message in my computer I get the screen to type the password of my private key to decrypt the messageand if password is correct the message is shown.
This could be a simple thing that can be elaborated in a better solution.
while true; do (cat mypipe > text.gpg); sleep 1; echo 'Message received:' && gpg --decrypt text.gpg ; done &
nc -l -p 50001 > mypipe &
echo "Hello world" | gpg -eas -r someones@gpgid.com | nc localhost 50001