Sign

Parties cooperate to sign a message together

Signing a message is a procedure which starts from the mobile phone and it is an interactive protocol as key generation protocol. The protocol we are using is from section 3.3 https://eprint.iacr.org/2017/552.pdf. By the end of the protocol the party who initiated the sign request on a message has the ECDSA signature on the message.

let message = "Hello world!";

// Generate a random session id.
let session_id = SessionId::random();

// Create signer instances for each participant.
let p1signer = P1Signer::new(session_id, keyshare1, message);
let p2signer = P2Signer::new(session_id, keyshare2, message);

// Round 1
let (p1signer, msg1) = p1signer.process(())?;
let (p2signer, msg2) = p2signer.process(msg1)?;

// Round 2
let (p1signer, msg3) = p1signer.process(msg2)?;
let (p2signer, msg4) = p2signer.process(msg3)?;

// Round 3
let msg5 = p1signer.process(msg4)?;
let sign = p2signer.process(msg5)?;

// Distributed signing is complete!

assert!(msg5.sign == sign)

Last updated