Get started with End to End Encryption in Vonage Video Client SDKs
Published on February 15, 2024

The 2.27 Client SDK comes equipped with enhanced end-to-end encryption (E2EE), ensuring that your data remains private and secure.

Following the addition of media encryption for routed sessions on JS Web clients in previous releases, we have updated support for End-to-End Encryption APIs to our 2.27 native SDKs: including iOS, Android, Windows, Linux, and MacOS. This helps customers who are focused on privacy and security protect their video sessions with an extra layer of security by encrypting the media payload at the client so that it will remain encrypted through the media server when routing media end-to-end to other mobile and desktop native clients.

But with all that said, how do you get started with ee2e? Let's take a quick look into just how easy it is to enable e2ee for all your client-side applications!

Using E2EE in Your Vonage Video Application

The process of using E2EE within your application is very straightforward, first, make sure the functionality is enabled on your developer account. Then, we enable E2EE when creating a session, and finally, on the Clients connecting to that session, we set an encryption secret. A valid secret is a string between 8 and 256 characters; all clients connecting to the session must use the same secret.

Server Side

To get started with E2EE, make sure that the functionality is enabled when creating your video session server side. This can either be done directly via the REST API by setting the e2ee property to true or if you are using one of the server SDKs, this can be done as part of the create session step. For example, in the Node.js SDK:

const Vonage = require('@vonage/server-sdk');

const vonage = new Vonage({
    applicationId: APP_ID,
    privateKey: PRIVATE_KEY_PATH
});

try {
    const session = await vonage.video.createSession({
         mediaMode: "routed",
         e2ee: true, // This will enable end-to-end encryption
    });
} catch(error) {
    console.error("Error creating session: ", error);
}

Web Client Side

To have a web client join an end-to-end encrypted session, specify the encryption secret when calling the OT.initSession() method:

const session = OT.initSession(
  'app-id',
  'session-id',
  {
    encryptionSecret: 'ENCRYPTION_SECRET'
  }
);

To see a full web application example of this feature checkout the End-to-End Media Encryption sample on github

Android Client Side

To have an Android client join an end-to-end encrypted session, specify the encryption before the client publishes or subscribes. This can be done by calling the Session.setEncryptionSecret() method:

private var session: Session? = null
...
session = Session.Builder(this, "app-id", "session-id").build().also {
    //Encrypt the connection
    it.setEncryptionSecret("ENCRYPTION_SECRET")
}

To see a full Android application example of this feature, check out the End-to-End Media Encryption sample on GitHub

iOS Client Side

To have an iOS client join an end-to-end encrypted session, specify the encryption before the client publishes or subscribes. This can be done by calling the Session.setEncryptionSecret() method:

lazy var session: OTSession = {
    return OTSession(apiKey: "app-id", sessionId: "session-id", delegate: self)!
}()
session.setEncryptionSecret("ENCRYPTION_SECRET", error: &error)

To see a full iOS application example of this feature, check out the End-to-End Media Encryption sample on GitHub

Further Reading

For more information on how to use E2EE in other Clients (Windows, macOS, and Linux) or further details on changing encryption keys and error handling, please take a look at the E2EE documentation.

Are you excited about End to End Encryption? How will you use it in your application? Please join us on our Vonage Community Slack or send us a message on X, previously known as Twitter, and let us know how we can help!

Zachary PowellSr Android Developer Advocate

Ready to start building?

Experience seamless connectivity, real-time messaging, and crystal-clear voice and video calls-all at your fingertips.

Subscribe to Our Developer Newsletter

Subscribe to our monthly newsletter to receive our latest updates on tutorials, releases, and events. No spam.