terl / lazysodium-java

A Java implementation of the Libsodium crypto library. For the lazy dev.
https://github.com/terl/lazysodium-java/wiki
Mozilla Public License 2.0
135 stars 48 forks source link

Signing multi-part messages (crypto_sign_init) #63

Closed erikvanzijst closed 4 years ago

erikvanzijst commented 4 years ago

The crypto_sign_init/crypto_sign_update/crypto_sign_final_create methods seem to be missing from lazySodium, limiting it to signing files that fit into memory.

I'm looking for a Java/Scala libsodium layer to sign arbitrarily large binary files. Am I overlooking something, or is this part not yet exposed in lazySodium?

Perhaps I can pre-hash the files through crypto_generichash_* and then crypto_sign_detached the resulting 512 bit hash?

gurpreet- commented 4 years ago

Hi @erikvanzijst, sure I can add them in for you and yes the multi part signing from Libsodium can do that, however it's always good to test your use-case out before. It may be that generhash may be the best way forward for your use-case.

Let me add those methods in a new release for you.

gurpreet- commented 4 years ago

This was added through PR #67.

An example of how it works is in the test: SignTest.signLongMessage.

gurpreet- commented 4 years ago

This is now available in release 4.2.5