The value of encryption increases over time simply because encryption keeps your call from eavesdroppers and protects confidential data, Obviously it shows more value when it comes to military or financial affairs.For a long time, I was concerned about Secure Voice (Ciphony) and finally I programmatically implement a simple system to provide an End to End voice encryption between two terminals with Java. In this instance I used Raspberry Pi and my Laptop. Of course it could be any two PCs or two Raspberry Pis.
PC or Laptop that has java installed in it.
Raspberry pi running Raspbian (Java is already installed in it).
External speaker and usb sound card for raspberry pi.
The system consists of two terminals, a PC and a Raspberry PI on same network. Java provides us a way to capture sound data (Digital) from a mic through TargetDataLine interface. Captured data is saved to a byte buffer array and then the encryption process made on this array using AES algorithm and finally it is sent through the UDP socket to receiver. On the receiver side, the packet is received and converted from encrypted form and sent the voice data to the speaker.
The sending and receiving process is done simultaneously (Full Duplex) and each terminal has parameters (IP and port) as receiver and as transmitter, so pay attention when you assign values of IPs and ports as shown in the code Github.
Every terminal works as a receiver (RX) server and also as a transmitter (TX) client as shown in the next image.
I used Advanced Encryption Standard (AES) with 128 bit key, you have an option to use 192 or 256 bit key. It is a symmetric encryption algorithm so in this case we must use a key distribution method to share the common key but to keep things simple I hard coded it in my code. You may notice a delay due to the low performance of the processor of raspberry pi in comparison with a typical PC.
Download the zip file [click here] which contains two netbeans projects one for Raspberry Pi "Securevoice_rpi" and the other "Securevoice" for PC.
Run each jar in its environment and enjoy secure voice chatting.