End to End Voice Encryption between Raspberry pi and PC using AES


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.


  1. PC or Laptop that has java installed in it.
  2. Raspberry pi running Raspbian (Java is already installed in it).
  3. External speaker and usb sound card for raspberry pi.
  4. USB power supply.
  5. Netbeans IDE to compile the source code.

System description:

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. 

Screen Shot 2016-08-04 at 12.03.35 PM

Encryption Algorithm:

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.


  1. Download the zip file [click here] which contains two netbeans projects one for Raspberry Pi "Securevoice_rpi" and the other "Securevoice" for PC.
  2. Compile them.
  3. Run each jar in its environment and enjoy secure voice chatting.

Test Video


  1. See this great article about AES.
  2. To configure usb sound card with raspberry this article.

Thanks to MR: James O'Connor for proofreading.

Subscribe to Our Mailing List



Blog Tags

Follow me

Facebook Page