PointyCastle / pointycastle

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

authenticated encryption #153

Open rbellens opened 6 years ago

rbellens commented 6 years ago

Added an interface class for authenticated encryption with associated data as well as two implementations: GCM and CBC with HMAC. See also issues #100 #112 #46

stevenroose commented 5 years ago

This looks great! Thanks! Could you perhaps rebase on top of the recent registry changes?? Then I can test and merge it!

BaloghTamas commented 5 years ago

That would be really great to have GCM implementation on the master branch. Is there any update on that PR?

paulreimer commented 5 years ago

This looks so helpful!

Just to confirm, but if I need AES/CCM, that will still require porting from BouncyCastle (but would be based on the BaseAEADBlockCipher from this PR)?

paulreimer commented 5 years ago

I rebased this PR on master + PR #175 + PR #174 (Seems to work OK for me!), and I ported AES/CCM from BouncyCastle. At first I tried to re-use the functions in BaseAEADBlockCipher, but that didn't work for me -- I ended up with a more direct port from BouncyCastle and @overrides (so, perhaps that base class is a bit GCM specific, or I used it incorrectly). Other than that, I was able to build on top of this quite easily.

I have a PR ready (for the AES/CCM mode) for when this gets merged.

na2axl commented 5 years ago

Unable to wait too long for this PR to get merged, I've rebased this on master and I've also merged #174 and #175 in my fork na2axl/pointycastle and i'm happy to see that everything works fine. I'm using this feature for a secured chat application with a server written in Golang sending and receiving encrypted messages from web (Javascript) and mobile (Dart/Flutter) clients through websockets, with AES/GCM implemented on each endpoints and working without problems.

knopp commented 5 years ago

@na2axl, there are two small issues I found so far in your fork, the GCM block cipher is not registered, and it fails with NPE if no associated text is present.

https://github.com/knopp/pointycastle/commit/389d6e3745446db006ac4071a73f3d8509b91fd5 https://github.com/knopp/pointycastle/commit/9f46f8e914aabe4e435d86bd49763af013ff6018

na2axl commented 5 years ago

Thanks @knopp I've merged your changes in my fork.

izaera commented 3 years ago

I'm archiving this repo as per #239 (see the issue for more info).