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.
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.
Test Video
Thanks to MR: James O'Connor for proofreading.