Feature Request: crypto_sign_sk_is_valid() #1192
paragonie-security
started this conversation in
Ideas
Replies: 1 comment
-
What is documented as the secret key in libsodium is actually the secret key followed by the public key. The seed is never documented as being the secret key. It's a seed, from which you get the 64 byte secret key. I don't know of any bindings that does things differently. The secret key always includes a copy of the corresponding public key. Who would be using an API that does the additional scalar multiplication?
Who would not be using that API?
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background information
In a lot of Ed25519 implementations, if you sign a message twice using the same Ed25519 secret seed (the first 32 bytes of the secret key) but a different public key (the remaining 32 bytes), you can create a condition like #170.
It also turns out to be possible to trigger the same misuse through libsodium; albeit, you have to go out of your way to do so.
Demo here: https://3v4l.org/VoREq
Given the above, I posit that it would be useful to have a feature to validate that a given secret key is valid (i.e. the public key portion does correspond to the given secret seed). This would mostly be helpful in wrapper libraries that want to assert that the Ed25519 secret key is valid, but only wants to assert it once at runtime (rather than updating the signing algorithm to check before every signing attempt).
Request
A new API (tentatively named
crypto_sign_sk_is_valid()
) which looks like this (except written by a more talented C programmer than me):Beta Was this translation helpful? Give feedback.
All reactions