asio_dtls icon indicating copy to clipboard operation
asio_dtls copied to clipboard

How to add DTLS extensions?

Open LubosD opened this issue 6 years ago • 1 comments

Is there any way to add DTLS extensions? I would need to add "use_srtp" (RFC5764) for WebRTC.

LubosD avatar Dec 11 '19 16:12 LubosD

There is no interface to enable it at the Moment.

But you can use the native handle like this:

#include <openssl/srtp.h>
 
asio::ssl::dtls::context ctx(asio::ssl::dtls::context::dtls_client);

int res = SSL_CTX_set_tlsext_use_srtp(ctx.native_handle(), "SRTP_AEAD_AES_256_GCM");
if(res != 0)
{
	asio::error_code ec = asio::error_code(
		static_cast<int>(::ERR_get_error()),
		asio::error::get_ssl_category());
		
	// Handle Error
}

// Create DTLS Socket, ...

sdamm avatar Dec 12 '19 16:12 sdamm