pc-dart icon indicating copy to clipboard operation
pc-dart copied to clipboard

EC encryption and decryption

Open tjcampanella opened this issue 2 years ago • 9 comments

Is there any EC engine for encrypting data with elliptic curve keys? I couldn’t find anything in the api reference. Thanks for any help.

tjcampanella avatar Jul 10 '21 04:07 tjcampanella

https://pub.dev/documentation/pointycastle/latest/api.ecc/api.ecc-library.html

AKushWarrior avatar Jul 10 '21 05:07 AKushWarrior

@AKushWarrior I don’t know if I am missing something, but I don’t see any way to encrypt data with it. Just ways to get the keys.

tjcampanella avatar Jul 10 '21 14:07 tjcampanella

Oh, yeah. This was done before I joined the project, so I'm not the most familiar.

It looks like the BouncyCastle engine is split across a bunch of files, but the entry point is https://www.github.com/bcgit/bc-java/tree/master/core%2Fsrc%2Fmain%2Fjava%2Forg%2Fbouncycastle%2Fcrypto%2Fec%2FECElGamalEncryptor.java

AKushWarrior avatar Jul 10 '21 15:07 AKushWarrior

Oh ok so this isn’t yet implemented for pointy castle. Thank you. I will look into implementing it myself.

tjcampanella avatar Jul 10 '21 16:07 tjcampanella

If you do, submit a PR! I have a feeling a lot of people would want/need this work.

I'll also use this issue as tracking if I get around to implementing this.

AKushWarrior avatar Jul 10 '21 16:07 AKushWarrior

I just forked a package I found doing this and I updated it for null safety and such. Would you mind taking a look and seeing what you think: https://github.com/tjcampanella/secp256k1Cipher.

tjcampanella avatar Jul 10 '21 20:07 tjcampanella

I just submit a pull request #127. Maybe it helps.

licy183 avatar Aug 06 '21 06:08 licy183

@mwcw I reviewed and this looks merge-ready to me.

AKushWarrior avatar Aug 06 '21 16:08 AKushWarrior

Yes, sorry about the delay.

mwcw avatar Aug 12 '21 04:08 mwcw