mirror of
https://github.com/luxfi/multi-party-eddsa.git
synced 2026-07-27 02:21:13 +00:00
Have managed to reproduce the bug exactly, run cargo test -- --nocapture
This commit is contained in:
@@ -8,3 +8,4 @@ Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
**/venv
|
||||
|
||||
@@ -25,8 +25,16 @@ mod tests {
|
||||
#[test]
|
||||
fn test_ed25519_one_party() {
|
||||
let message: [u8; 4] = [79, 77, 69, 82];
|
||||
let party1_keys = KeyPair::create();
|
||||
// let party1_keys = KeyPair::create();
|
||||
let priv_str = "48ab347b2846f96b7bcd00bf985c52b83b92415c5c914bc1f3b09e186cf2b14f"; // Private Key
|
||||
|
||||
let mut priv_dec = decode(priv_str).unwrap();
|
||||
priv_dec.reverse();
|
||||
let priv_bn = BigInt::from_bytes(&priv_dec[..]);
|
||||
|
||||
let party1_keys = KeyPair::create_from_private_key(&priv_bn);
|
||||
let signature = Signature::sign_single(&message, &party1_keys);
|
||||
println!("TESTTEST\n\n{:?}\n", party1_keys.public_key.bytes_compressed_to_big_int().to_hex());
|
||||
assert!(verify(&signature, &message, &party1_keys.public_key).is_ok());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
from nacl.encoding import HexEncoder
|
||||
from nacl.signing import SigningKey
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
# Generate a new random signing key
|
||||
signing_key = SigningKey('48ab347b2846f96b7bcd00bf985c52b83b92415c5c914bc1f3b09e186cf2b14f', encoder=HexEncoder)
|
||||
|
||||
# Sign a message with the signing key
|
||||
signed_hex = signing_key.sign(b"Attack at Dawn", encoder=HexEncoder)
|
||||
|
||||
# Obtain the verify key for a given signing key
|
||||
verify_key = signing_key.verify_key
|
||||
|
||||
# Serialize the verify key to send it to a third party
|
||||
verify_key_hex = verify_key.encode(encoder=HexEncoder)
|
||||
print(verify_key_hex)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user