-
Notifications
You must be signed in to change notification settings - Fork 49
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
Find a way to fit more info into QR codes #32
Comments
I don't think that's possible. The maximum QR code capacity is 2953 bytes (Wiki) Size of a 4096 bit GPG RSA key is almost twice as much (In my tests I got 4908 bytes). Each QR shard is the same size as an original payload. (secrets.js-grempe doc). |
@prybalko well, the actual export of So there's a http://www.jabberwocky.com/software/paperkey/ project, which is intended to strip down the GPG exported output to the slimmest meaningful payload. |
You need some redundancy to remain zero knowledge, but you could make the output scale linearly in the input size, maybe (k/2) * 2953 bytes or something, not 100% sure right now. |
@burdges do you mean the length of our plaintext leaking via the length of the cyphertext, or some other leak vector I don't get at 8pm on Friday? I'd really-really prefer not to mess with secrets.js-grempe, the idea for BananaSplit it to be a minimal codebase on top of already-audited primitives... |
@burdges could you elaborate how? |
Also, we loose additional 33% on conversion from binary |
It's more another project than this one but.. Reed-Solomn and Shamir secret sharing are both Lagrange interpolation. Reed-Solomn encodes only real data, so if you've only some shares and the data obeys some known distribution, then you learn something about the distribution of the original data. You presumably use Shamir secret sharing here because it addresses this weakness by encoding k-1 random strings. It cannot have shares smaller than the original data because it's encoding so much randomness. In principle, one could find some middle ground where you encode enough randomness that nothing really leaks, but messy. In fact, the best approach is something else:
Now each shard is like It sounds like another project, or really an add one for Fred's project, like I said.. |
@prybalko those are valid places to lose the compression rate — but neither sounds like something which cannot be solved. I totally get how this is a bigger of an undertaking than expected, so wouldn't mind if we just settle on the concrete plan for this for now (say, a checklist as a part of this issue) and not include this issue in the next release's milestone. |
@burdges oh, I like the trick with RS-encoding the encrypted data. banana_split/src/util/crypto.ts Line 110 in 19bc8b3
Currently we (ask users to) put the full decryption passphrase in handwriting onto the printouts — but if we salt that seedphrase and shamir-share that additional salt I think we'd be good. Do you have any links to the Rogaway's work in writing anywhere? |
Combining Reed-Solomon with Shamir secret share sounds like a big step towards increasing payload capacity. Not sure it's worth implementing the base64 trick right now. |
Again, one should look at Fredric Jacobs code https://github.com/SpinResearch/RustySecrets before running off on my off the cuff suggestion. ;) It looks as if he never implemented Rogaway's paper though, not sure the situation. I'll try to ask him sometime. |
Unfortunately, it's borderline impossible to embed webassembly bytecode directly into our RustySecrets doesn't do anything fancy with Reed-Solomon encoding, though — just a regular Shamir, but authenticated with signatures? In BananaSplit authentication happens in the AEAD encryption mode (with the decryption phrase you copy to the shards in handwriting), having an extra authenticity layer doesn't seem that important to me here... |
I strangely see nothing there about Rogaway's paper either.. https://eprint.iacr.org/2020/800 |
Current maximum size of QR payload is limited by the truncation which happens in the QR generation library after certain size of the payload.
If we choose a library which allows larger QR codes (and then making sure that the QR reading library also supports those sizes), we might increase the maximum size fitting to a A4 page significantely.
We should also investigate compression, QR encoding alphabets and redundancy options.
(Meaningful size target here would be ascii-armored 4096 bit GPG RSA key.)
The text was updated successfully, but these errors were encountered: