Datagram Transport Layer Security (DTLS) on Android/Java
Has anyone used DTLS on Android or is there an open source Java implementation that supports DTLS?
What are开发者_如何学Go my other options for securing UDP traffic on Android?
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).
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: http://yassl.com/yaSSL/Products-wolfssljni.html
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.
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.
精彩评论