dusk-network / schnorr

Schnorr Signature algorithm usiing BLS12-381 Curve
Mozilla Public License 2.0
13 stars 19 forks source link

NotePublicKey derivation, signing and verification must also work with a custom Generator G #107

Closed Neotamandua closed 9 months ago

Neotamandua commented 9 months ago

Summary

For this library to work with Zedger keys and signing, we need to be able to pass custom generators G.

Detailed Description

The NoteSecretKey consists of a JubJubScalar. The NotePublicKey gets derived by multiplying the Scalar with a const GENERATOR_EXTENDED. The signing, verify and other relevant functions therefore also use this same const GENERATOR_EXTENDED.

Zedger keys have different generators G on a per-key basis. Because of that we need to have the possibility to use custom generators in all relevant parts of dusk-schnorr for signing purposes in Zedger. Right now I could create a NotePublicKey through the from_raw_unchecked function where I pass a JubJubExtended which got calculated with a different Generator, but the signing and verification is still not possible then.

Possible Solutions

moCello commented 9 months ago

My suggestion would be to have the Signatures generic over a constant generator G (or two generators in case of DoubleSignature)

moCello commented 9 months ago

I revert from the above suggestion to make the signatures and public keys generic over the generator(s). The reason behind is that, with the generic approach, when de-serializing a signature: we would need to know the generator before we de-serialize. This is not possible since the generator(s) can be any element of our sub-group of jubjub points.