salty icon indicating copy to clipboard operation
salty copied to clipboard

Allow signing and verifying by hash

Open mkj opened this issue 3 years ago • 2 comments

I have a need to sign and verify messages that are not contiguous in memory. These added methods allow that, with a user provided closure providing the hash of the message.

The use case is that I am serializing a message on-the-fly from parts to sign or verify, without copying it into a contiguous buffer. I have implemented DynDigest so that the user provided functions can more easily use Salty's sha512.

mkj avatar Sep 23 '22 12:09 mkj

I've noticed a pull request for a similar feature in ed25519-dalek, though that API would only work for verification not signing (signing needs the hash twice whereas verification only needs one pass). https://github.com/dalek-cryptography/ed25519-dalek/pull/196 Just in case anyone's thinking of common APIs.

mkj avatar Mar 29 '23 13:03 mkj

Interesting choice of API, I like it!

I was previously thinking of something along the lines of https://doc.rust-lang.org/std/io/trait.Read.html#method.read_vectored (to have precedent), that is, passing a slice of slices.

There is movement in the Dalek repos, a long term goal would be to merge this library as a backend there so I no longer have to maintain it :)

nickray avatar Apr 06 '23 13:04 nickray