Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 12 byte IV for OMEMO and aesgcm:// #1171

Closed
iNPUTmice opened this issue Jan 18, 2020 · 6 comments · Fixed by #1180
Closed

Support 12 byte IV for OMEMO and aesgcm:// #1171

iNPUTmice opened this issue Jan 18, 2020 · 6 comments · Fixed by #1180

Comments

@iNPUTmice
Copy link

Conversations (and others) will very soon start sending 12 byte IVs for both OMEMO messages as well as the aesgcm:// uri scheme in order to better support libraries on other plattforms that only accept 12 bytes.

@chrisballinger
Copy link
Member

Thanks for the heads up! Can you link to the spec / docs for that change? I don't see any mentions of the 12 vs 16 byte IV issue or aesgcm uri scheme here: https://xmpp.org/extensions/xep-0384.html

@licaon-kter
Copy link
Contributor

The story goes that
https://xmpp.org/extensions/inbox/omemo-media-sharing.html says something but some sort of typo started it at 16 and now everyone should get in line. :)

@iNPUTmice
Copy link
Author

The OMEMO spec doesn’t specify the length of the initialization vector. We originally started using 16 because that is a common size for other AES standards. However at some point we discovered that AES-GCM recommends and uses internally 12 bytes. If you put in something other than 12 it will first be converted to 12. However not all crypto libraries support that initial conversion step and allow only inputs for 12. (Apparently new libraries from Apple that natively support GCM)
So our plan was that for some time clients can read both 12 and 16; and at a later point we switch to sending 12.

I guess we originally filed this in the wrong repository: ChatSecure/OTRKit#40

The aesgcm:// spec that exists (and that @licaon-kter linked) has always specified 12; Just the example is wrong.

@iNPUTmice
Copy link
Author

I did some testing with a ChatSecure user and it seems to me that ChatSecure can read 12 byte OMEMO messages but not download 12 byte HTTP uploads (aesgcm uri scheme). To me it sounds somewhat plausible that ChatSecure would just pipe the contents of the IV element directly into the crypto library (without sanity checking it first); but for aesgcm:// one probably needs to do a little more.

In any case this sounds like an easy enough fix.

@Neustradamus
Copy link

@chrisballinger: It will be nice to sent directly with 12 byte IV.

@Neustradamus
Copy link

@chrisballinger: iOS 13 only?

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 a pull request may close this issue.

4 participants