Skip to content

Add a key size option for AES-256 E2EE keys - #1061

Open
netbrut wants to merge 2 commits into
livekit:mainfrom
netbrut:e2ee-aes256-key-size
Open

netbrut wants to merge 2 commits into
livekit:mainfrom
netbrut:e2ee-aes256-key-size

Conversation

@netbrut

@netbrut netbrut commented Nov 4, 2026

Copy link
Copy Markdown

Fixes #1060. Android counterpart of the Swift change in #1200.
BaseKeyProvider always derived AES-128 frame keys. The prefixed WebRTC library already used by this SDK (150.7871.04) accepts the key size: FrameCryptorFactory.createFrameCryptorKeyProvider has an overload with a trailing int (bits), and the shorter overload passes 128. This PR only forwards it.
• New KeyProviderKeySize enum (BITS_128 default, BITS_256), added as the last BaseKeyProvider constructor parameter, so existing callers are unchanged.
• Default key provider in E2EEOptions explicitly uses 128.
• Changeset (minor).
Every participant in a room must use the same size; the KDoc says so.
Verified: :livekit-android-sdk:compileDebugKotlin passes. Not verified: runtime behavior (needs a device) and JS ↔ Swift ↔ Android interop with keySize: 256. I'm happy to run the interop test as soon as a release is out.

BaseKeyProvider always derived AES-128 frame keys. The prefixed WebRTC
Android library already accepts the key size (a trailing int, in bits,
defaulting to 128 in the shorter overload of createFrameCryptorKeyProvider),
so this only forwards it.

Adds KeyProviderKeySize (BITS_128 default, BITS_256) as the last
BaseKeyProvider constructor parameter, so existing callers are unchanged.
Every participant in a room must use the same size. Matches
KeyProviderOptions.keySize in the JS SDK and the Swift SDK (#1200).

Fixes livekit#1060

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011bMyZt4jGEfw4YQ5siiMRs
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: efbc333

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
client-sdk-android Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Adds a short example for the new BaseKeyProvider keySize option to the
e2eeOptions documentation, as the repository guidelines ask for new
public APIs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011bMyZt4jGEfw4YQ5siiMRs
@netbrut

netbrut commented Nov 4, 2026

Copy link
Copy Markdown
Author

Thanks. We kept the new parameter last with a default so source compatibility is unchanged. BaseKeyProvider's constructor has grown the same way before (e.g. keyDerivationAlgorithm in #886), so we followed that pattern rather than adding hidden overloads. Happy to add a hidden deprecated constructor with the previous signature if the maintainers prefer binary compatibility here.

@tangowhisky-dev

Copy link
Copy Markdown

Thanks for working on this. I'm already working on an app which uses E2EE and would like this very much ported in android (Web & Swift already provides it, swift-recently merged). Would very much like this feature enabled. Happy to test it out when available.

@davidliu

Copy link
Copy Markdown
Contributor

LGTM, @netbrut can you sign the CLA?

@netbrut netbrut closed this Nov 20, 2026
@davidliu

Copy link
Copy Markdown
Contributor

@netbrut I'd rather not let this one go just over the CLA bot not working for you, can you just comment here and say you've signed the CLA? I think that should be fine enough for our policies.

@netbrut netbrut reopened this Nov 20, 2026
@netbrut

netbrut commented Nov 20, 2026

Copy link
Copy Markdown
Author

Sorry for closing this, my mistake. I have signed the CLA. The CLA bot stays pending because the commits were authored under the git identity "claude", which maps to an unrelated GitHub account, so it can't be signed for. I'm the author of this contribution and I agree to the CLA for it. Happy to re-author the commits under my own account if you'd prefer the check to go green.

@davidliu

Copy link
Copy Markdown
Contributor

I've confirmed with our team that just commenting here is good enough to cover it, so you're all set. Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2EE: support keySize 256 (AES-256-GCM) on native SDKs — JS already has keySize: 128 | 256

5 participants