-
Notifications
You must be signed in to change notification settings - Fork 2.7k
sign(...)
in sr25519
requires randomness
#12009
Comments
sign(...)
in sr25519
requires randomness
What are you trying to do? Creating a signature always requires randomness. |
There are derandomized signatures, but signatures always require secrets, and if you've a problem with randomness, then you typically also have a problem with secrets. In fact, sr25519 like ed25519 can derandomized, but it's easier to miss-use the interface provided. We plan to fix the interface, but it's not a high priority.. w3f/schnorrkel#82 There are variations on sr25519 in the schnorrkel crate that cannot be derandomized, so it's simplest for downstream users if we assume that if you've secrets then you've system randomness too. |
I am trying to test my function that verifies the signature inside. I am not against the randomness in creating a signature, but I'm against the unclear API that makes it difficult to use in some cases. So I came up with some solutions. |
It does matter, tremendously, that is why I asked. There is an SE answer here which covers signing and verifying in a test: https://substrate.stackexchange.com/a/4225/94 |
Not sure why you are writing your test in Wasm. You would need to provide some more information on what you are doing to get help. The |
I try to reformulate the issue of @puzzle-rusher . Fact: So regardless of what he is trying to do, the intended target (wasm/native), the usage (test/non-test/bench) and if is correct or not; what I think he wanted to highlight is that is possible to do so. Thus, when the user builds |
Is there an existing issue?
Description of bug
When I tried to use
sr25519::Pair::sign
function from sp-core withdefault-features = false, features = ["full_crypto"]
I ran into an error likeThen I added "getrandom" in the sp-core's
cargo.toml
and addedrand
tofull_crypto
dependencies and it started working.Maybe I did something wrong, please give me a solution to this problem.
If there are no hacks here, I suggest two solutions, to do something like above or remove
sign
function fromfull_crypto
feature.The text was updated successfully, but these errors were encountered: