PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
271 stars 76 forks source link

Galois/Counter Mode #100

Open jfphilbin opened 8 years ago

jfphilbin commented 8 years ago

Any chance of getting GCM implemented. I'm using Dart to build a medical imaging management system, which is a follow on to one we built in Java. As I'm sure you know, GCM has some nice properties for performance on large objects. Medical imaging studies are large from 512k (1 image) to > 1GB for CT or MRI. If GCM is not in the cards can you suggest another one-pass AES block cipher. I would be willing to create a Pull Request, if you could point me at the right Bouncy Castle sources.

stevenroose commented 7 years ago

Interesting.

Here is the Bouncy Castle source: https://github.com/bcgit/bc-java/blob/master/core/src/main/java/org/bouncycastle/crypto/modes/GCMBlockCipher.java

It'd be a first for me too, but I'll try to take a look at it asap to see if I can make something of it.

Seen from the Bouncy Castle unit tests for GCM, there are several different "multipliers" that specify the mode of operation. Seems like that will complicate the matter :)

izaera commented 7 years ago

Hi @stevenroose

I suggest creating Junit (or whatever) tests for BC with different inputs, printing the outputs and then move those tests to Dart. Then try migrating the code from Java to Dart, then run the tests, then debug as much as you can until all works :-D.

Something that helps is printing the intermediate state of the algorithm in java and dart and compare them. Usually errors come from loop to loop because you leave some pointer with a bad value, or things like that...

May the luck be with you ;-P

stevenroose commented 7 years ago

@izaera Thanks for the suggestion. For now, I have a thesis to finish by the end of August, so I'll have my hands full, but I really want to give this a shot thereafter.

izaera commented 7 years ago

@stevenroose Good look with the thesis, then :-)