Closed watzon closed 3 years ago
I do intend to add a bunch of AES modes at some point. My focus currently is getting #77 through (null-safety is coming!), but after that my goal is to add algorithms that have a significant use in standards. In terms of block cipher modes, my list currently includes CCM (#64) and GCM-SIV; I can add this to the list if it's a critical building block in something like Telegram.
That would be great! For now I can try to mock it using the Python impl as inspiration, but I'm not a cryptography expert so I'm sure someone else could do it much better.
It actually does look like the Java version of BouncyCastle has a full IGE block cipher, so this could be a better jumping off point https://www.javatips.net/api/Wire-Desktop-master/src/org/bouncycastle/crypto/modes/IGEBlockCipher.java
Edit: nvm that's not official, but still a good jumping off point
https://github.com/bcgit/bc-java is the official repository, for future reference.
Yeah thanks haha, I found it after
Based on that Java source you shared (which I cross-checked against the specification; it seems correct), this should be a fairly minimal task to implement in Dart. I'll take a crack once null-safety is fully merged.
Yeah IGE is almost CBC, just ever so slightly different. Can't wait to see it get added. I'll be waiting!
I just finished implementing this and tests are passing. @mwcw should I fold this into #77 or create a separate PR after?
@watzon this is part of #77 now. It should come out as part of 3.0.0.
Thanks!
This was released in the latest update, which is labeled 3.0.0-nullsafety.2 on https://pub.dev and has code in a branch of this repository. As of right now, the algorithm is only available in the null-safe version of this library, but you can trivially port it to non-null-safety. @mwcw you can close this.
You're awesome @AKushWarrior! Thanks!
I'll be the first to admit that there aren't a ton of use cases for IGE, but it is a valid AES based algo and there aren't many libraries that support it (and absolutely none in dart afaik). Basically IGE has one purpose, it's used in MTProto, Telegram's encrypted communication protocol.
I'm playing with the idea of writing a Dart library for MTProto so that I can build a Telegram client using Flutter, but first I need IGE support. The nice thing is that IGE itself is fairly simple. [Here's an example(https://github.com/pyrogram/pyrogram/blob/master/pyrogram/crypto/aes.py#L85)] of it being done in Python with the support of
pyaes
.Another example which actually uses BouncyCastle's Java library is number 35 here.
Any thoughts? Maybe this belongs in the actual BouncyCastle repo?