Published 19 Sep, 2022

Java - Datagram Transport Layer Security (DTLS) on Android/Java

Category Java
Modified : Oct 03, 2022

Has anyone used DTLS on Android or is there an open source Java implementation that supports DTLS?

What are my other options for securing UDP traffic on Android?


There are 4 suggested solutions here and each one has been listed below with a detailed description. The following topics have been covered briefly such as Java, Android, Udp, Datagram, Dtls. These have been categorized in sections for a clear and precise explanation.


DTLS support is not available in pure Java yet. We ended up using OpenSSL through JNI. I doubt you will find anything on Android.

You should use TLS (which means you have to use TCP).


Californium offers a DTLS 1.2 library (scandium) in java, so you don't need any native stuff to make it working. It supports DTLS 1.2 Connection ID to overcome broken DTLS encryption contexts, when an address change occurs. Depending on the use-case, CoAP may make sense as well. Using both enables an android device to exchange data encrypted with a cloud server, moving around or changing between cellular or wifi without new handshakes.


Nowadays OpenSSL for Android is not a good option, I am currently using Mbed TLS library, easy compiles with Android NDK, works fine, small footprint, recommend it.


wolfSSL recently created an open source JNI wrapper around the lightweight SSL/TLS library, CyaSSL. The wrapper supports both DTLS 1.0 and DTLS 1.2 - in addition to current SSL/TLS standards up to TLS 1.2.

Both CyaSSL and the JNI wrapper are dual licensed under the GPLv2 as well as a commercial license to accomodate both personal/hobby and commercial project needs.

You can find our JNI wrapper here: