-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: ser/de update and use nonrecoverable sig for secp256k1/r1 #7423
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
1e7ce5c
to
27bea1b
Compare
Err(_) => return Ok(NativeResult::ok(cost, smallvec![Value::bool(false)])), | ||
}; | ||
|
||
match public_key.verify_hashed(&hashed_msg_ref, &signature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified a bit:
let result = public_key.verify_hashed(&hashed_msg_ref, &signature).is_ok();
Ok(NativeResult::ok(cost, smallvec![Value::bool(result)]))`
Looks good to me! |
@@ -0,0 +1,68 @@ | |||
// Copyright (c) Mysten Labs, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this test to e2e since it needs to get api version to decide which signing function to use
@@ -44,7 +44,9 @@ export class Account { | |||
async sign(data: Base64DataBuffer): Promise<SignaturePubkeyPair> { | |||
return { | |||
signatureScheme: this.#keypair.getKeyScheme(), | |||
signature: this.#keypair.signData(data), | |||
// TODO(joyqvq): Remove once 0.25.0 is released. | |||
// This is fine to hardcode useRecoverable = false because wallet does not support Secp256k1. Ed25519 does not use this parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @pchrysochoidis this will be removed after 0.25.0 is released
) ## What Changed - For CLI and SDK, a ECDSA k1 and r1 signature is produced using the nonrecoverable form. This means the signature is 64 bytes instead of 65. - The signature verification in sui also uses the nonrecoverable option. A valid signature should have 64 bytes. - For wallet, since only Ed25519 is supported, the secp256k1 change should not affect. - Also exposes secp256k1_verify and secp256k1_verify_recoverable API in move. - Ser/de of public keys and signatures now uses the most compact serialization with ToFromBytes. ## What Do You Need To Do - If you are using SDK to produce a Secp256k1 signature, no change is needed as long as you are using the latest version. - If you are using something else to produce a signature, your old signature will not be considered valid. You should just need to remove the last byte (65->64 bytes) to make it a valid signature again. Next: - r1 verify and verify_recoverable added in #7773
What Changed
What Do You Need To Do
Next: