Call security – constant bit rate encoding and improving WebRTC
Improving the calling experience at Wire also means a continued focus on the security and privacy of the calls. A recent upgrade to a new calling protocol introduced end-to-end authentication and removed all calling related activity data from Wire servers.
Today, we’re making constant bit rate encoding (CBR) an option for users. This, in combination with end-to-end encryption and zero calling-related metadata collection makes Wire the safest calling experience available.
During a call our speech is encoded and compressed into data packets, which have varying lengths, depending on the words we use. Theoretically there’s a risk that one could compare encrypted calls with pre-recorded sentences to find out if these sentences are contained in the call.
Using CBR takes care of that risk, as the packet length is always the same.
We’ve also submitted a patch to Google, who maintains WebRTC, to enable CBR support in WebRTC — a standard used by the majority of real-time communications providers today.
VBR vs CBR
Wire uses Opus codec for audio data encoding. Opus provides great audio quality, even in challenging networking conditions. The audio stream from Opus is then encrypted using the SRTP standard, providing end-to-end encryption for all calls — audio and video, 1:1 and group calls.
Opus’ default mode uses variable bit rate (VBR) encoding, which is a form of audio data compression. This helps audio streams to be sent over very narrow bandwidth links, like 2G networks on mobile phones.
Variable bit rate encoding has been criticised in the past for providing an observer of encrypted audio stream with “metadata”. Since different sounds are encoded differently, small variations in packet sizes can be observed.
The immediate question of course is how useful this “metadata” is, and can information about the call content indeed be extracted from it. The topic has been controversial, particularly within IETF where Opus was standardised in 2012 by its main authors Koen Vos and JM. Valin.
Academic research has shown that under specific circumstances whole pre-recorded sentences could be recognised despite the encryption, but not individual words. It is important to note that these papers analyse the use of a different codec called Speex, where differences between CBR and VBR encoding are much more pronounced.
“The way the bitrate is generated in Speex and Opus is quite different: The Speex VBR is based on explicit “open-loop” heuristics that come directly from analysing the signal. The Opus VBR code is based a lot (though not entirely) on entropy-coding-related variations. These are still influenced by the signal, but not so directly. It is therefore not clear how applicable the results are to Opus VBR,” says JM. Valin.
There are differences in the efficiency between VBR and CBR encoding. The bitrate overhead is typically around 10% for CBR compared to VBR encoding of active voice.
“Over the typical course of a call with active and inactive parts (prolonged silence of a participant) the bitrate for CBR is about 20–30% higher, due to the fact that VBR can better compress the inactive parts,” notes Koen Vos.
Using less CPU resources, the computational efficiency is higher for VBR encoding, and is therefore more battery friendly.
A guideline for assessing scenario-dependent risks and use of VBR, written by JM. Valin, offers the most nuanced view on the VBR vs CBR topic.
The general consensus is that VBR encoding gives enough protection for unstructured voice calls and does not generally put users of VoIP products at risk.
Improving Wire, improving WebRTC
Wire is the first secure messenger on mobile to offer Opus constant bitrate encoding.
On desktop, Wire relies on the standard WebRTC implementation used in browsers, where Opus CBR encoding is not yet supported.
We’re working with Google to fix that, and have submitted a patch to the WebRTC team, that adds the option of Opus CBR encoding. We hope that the patch will be quickly accepted and Chrome browser becomes CBR compatible which in turn brings the feature to our Electron/Chrome-based desktop app.
Helping to make Opus CBR an option in WebRTC is the right thing to do — ultimately it gives secure communication tools to more people who need it the most. All companies and products that rely on the standard WebRTC can take advantage of the increased security of CBR encoding as soon as Google accepts the patch.
For Wire users VBR remains the default with an option to switch to CBR calls. This toggle is available in Wire settings in the latest Android version, will be available on iOS soon. CBR encoding will apply to both incoming and outgoing calls.