ggmpc.ecdsa

ECDSA threshold signing library.

Module Contents

Classes

Ecdsa

Threshold signing over the ECDSA cryptosystem.

class ggmpc.ecdsa.Ecdsa(curve)

Threshold signing over the ECDSA cryptosystem.

Parameters:

curve (ggmpc.Curve) – The ECDSA curve to use.

secret_generate()

Generate a secret that can be used as a contribution in DKG.

Returns:

A secret.

Return type:

int

key_share(i, t, n, u=None)

Generate shares for player at index i of key split (t,n) ways.

Parameters:
  • i (int) – Player index.

  • t (int) – Signing threshold.

  • n (int) – Number of shares.

Returns:

Dictionary of shares. Share at index i is a private p-share. Other indices are n-shares to be distributed to players at their corresponding index.

Return type:

dict

key_combine(P)

Combine data shared during the key generation protocol.

Parameters:

P (tuple) – Tuple of shares for every player. Must include player’s private p-share and n-shares received from all other players.

Returns:

Dictionary of shares. Share at player’s index is a private x-share. Other indices are y-shares to be used when generating signing shares.

Return type:

dict

sign_challenge(S)

Create a challenge that another signer uses to prove their nonce contributions during MtA conversion.

Parameters:

S (tuple) – Tuple of shares for each signer. Must include player’s private x-share and y-shares received from all other signers.

Returns:

Dictionary of shares. Share at signer’s index is a private h-share. Other indices are j-shares to be distributed to signers at their corresponding index.

Return type:

dict

sign_share(S)

Create signing shares.

Parameters:

S (tuple) –

Tuple of shares for each signer. Must include either:

  • The signer’s private h-share and j-shares received from all other signers.

  • The signer’s private x-share and j-shares received from all other signers.

Returns:

Dictionary of shares. Share at signer’s index is a private w-share. Other indices are k-shares to be distributed to signers at their corresponding index.

Return type:

dict

sign_convert(S)

Perform multiplicitive-to-additive (MtA) share conversion with another signer.

Parameters:

S (tuple) –

Tuple of shares for this signing pair. Must include either:

  • The signer’s private w-share and the k-share received from the other signer.

  • The signer’s private x-share, the signer’s y-share for the other signer, and the k-share received from the other signer. Use only in a 2-of-* threshold setup.

  • The signer’s private w-share and the alpha-share received from the other signer.

  • The signer’s private beta-share and the alpha-share received from the other signer.

  • The signer’s private beta-share and the mu-share received from the other player.

Returns:

Dictionary of shares. Share at signer’s index is either:

  • A private beta-share if S included a k-share.

  • A private private gamma-share if S included an alpha-share or a mu-share.

If there is another index, it will be a share to send to the other signer. The share will be either:

  • An alpha-share if S included a k-share.

  • A mu-share if S included an alpha-share.

Note that if S included a mu-share, there is no share to send to the other player and this function returns a dictionary containing a single index which will point to the signer’s private gamma-share.

Return type:

dict

sign_combine(shares)

Combine gamma-shares for each of your signing pairs in the list of signers, or, combine s-shares to produce the final signature.

Parameters:

shares (tuple) – Tuple of gamma-shares or tuple of s-shares.

Returns:

If shares included gamma-shares, returns a dictionary of shares. Share at signer’s index is a private omicron-share. Other indices are delta-shares to distribute to all other signers. If shares included s-shares, returns a fully reconstructed signature.

Return type:

dict

sign(M, S)

Sign a message.

Parameters:
  • M (bytes) – Message to sign.

  • S – Tuple of shares for each signer. Must include signer’s private omicron-share and delta-shares received from other signers.

Returns:

Signature share to be combined with all other signers’ signature shares.

Return type:

dict

verify(M, sig)

Verify a signature.

Parameters:
  • M (bytes) – Signed message.

  • sig (dict) – Signature.

Returns:

True if signature is valid; False otherwise.

Return type:

bool