whyoleg / cryptography-kotlin

Kotlin Multiplatform cryptography / crypto library
https://whyoleg.github.io/cryptography-kotlin/
Apache License 2.0
344 stars 20 forks source link

Add ability to use custom IV in AES/GCM #38

Closed morki closed 2 months ago

morki commented 4 months ago

See #36

whyoleg commented 3 months ago

Hey @morki, are you still willing to finish PR? Or I could finish it? The reason I'm asking, is that I do have some changes to be merged which will have conflicts. If I will merge them, this PR is most likely will need to be redone from scratch (by copy-pasting changes)

morki commented 3 months ago

Hi @whyoleg, I was planning to create tests etc, but I am on vacations now, so I can not finnish it for about 3 weeks now. If you want and have time, you can finish this before the changes. If not, that is ok too, I can start from stratch after your changes :)

morki commented 3 months ago

Hi @whyoleg, is it somewhat "stable" now to start to do this PR again from scratch or would you suggest to delay it a bit more due to heavy changes still in progress?

whyoleg commented 3 months ago

Hey! You can proceed with the changes. May be even not from scratch 😀

I've decided to postpone big changes for some future release as I was not really happy with the API shape.

whyoleg commented 2 months ago

Hey @morki are you still willing to work on this PR? I'm planning to do a release by the end of September and wanted to include this.

morki commented 2 months ago

Hi @whyoleg, yes I am, will try to finnish it in a couple of days :)

morki commented 2 months ago

I think it is ready for what I can do for it. But it has one problem with tests.

WebCrypto and OpenSSL providers are ok, but JDK are throwing Cannot reuse iv for GCM encryption, because of built-in "security" and how are tests working now.

I tried but I really don't know how to solve it. Can you please take a look @whyoleg?

morki commented 2 months ago

Hey @whyoleg, i fixed those little things and applied your patch to tests. The Cipher interface hierarchy is something over my power, I tried in #45 but don't think it is the right way.

morki commented 2 months ago

Ou, and the apiDump. I tried it even before, but locally for me it is failing with:

* What went wrong:
Execution failed for task ':cryptography-provider-apple:watchosArm64ApiInfer'.
> There was a failure while executing work items
   > A failure occurred while executing kotlinx.validation.KlibInferAbiWorker
      > The target watchosArm64 is not supported by the host compiler and there are no targets similar to watchosArm64 to infer a dump from it.
whyoleg commented 2 months ago

Hm, I see. It needs macOS :) For this PR probably it should be enough to run :cryptography-core:apiDump as only this module has changed it ABI. Could you try it? If not, I will merge the commits manually after running apiDump on my side. Otherwise, looks good!

morki commented 2 months ago

I run it and it works, thank you for the guidance :)