You always thought that end-to-end encryption in your favorite messenger like WhatsApp is a big deal? Or is it even not supported? Well, here is an example showing how “new” this feature is and it works for 15 years now. Using a Unix system (macOS, Linux etc.) it is a one-liner to send encrypted messages using the commands nc and openssl.
On the receiver computer (with network name “ReceiverPC”) type (remove -p when using macOS):
while true; do nc -l -p 9999 | openssl aes-256-cbc -salt -d -k passwd | tail; done
So what happens here? There is a while loop to receive messages until you type Ctrl-C. In each iteration netcat is executed that just listens on port 9999 and pipes all received data to the next command openssl. It tries to decrypt the data and displays it. In contrast to the usual solution a symmetric encryption is used here: AES. Advantage: No certificates or similar are required. Disadvantage: Both sender and receiver need to know the password which is just “passwd” here. Of course you can replace the encryption with an asymmetric if you like.
And now, on the sender side type:
echo "Hello World" | openssl aes-256-cbc -salt -e -k passwd | nc ReceiverPC 9999
As we send only one message (Hello World) we don’t need a loop. It is first encrypted by openssl and the sent by netcat to “ReceiverPC” port 9999. That’s all. Please note that both computer must be on the same network or you have to setup your router to forward port 9999 on the receiver side.