:py:mod:`ggmpc.ecdsa` ===================== .. py:module:: ggmpc.ecdsa .. autoapi-nested-parse:: ECDSA threshold signing library. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ggmpc.ecdsa.Ecdsa .. py:class:: Ecdsa(curve) Threshold signing over the ECDSA cryptosystem. :param curve: The ECDSA curve to use. :type curve: ggmpc.Curve .. py:method:: secret_generate() Generate a secret that can be used as a contribution in DKG. :return: A secret. :rtype: int .. py:method:: key_share(i, t, n, u=None) Generate shares for player at index `i` of key split `(t,n)` ways. :param i: Player index. :type i: int :param t: Signing threshold. :type t: int :param n: Number of shares. :type n: int :return: 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. :rtype: dict .. py:method:: key_combine(P) Combine data shared during the key generation protocol. :param P: Tuple of shares for every player. Must include player's private p-share and n-shares received from all other players. :type P: tuple :return: 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. :rtype: dict .. py:method:: sign_challenge(S) Create a challenge that another signer uses to prove their nonce contributions during MtA conversion. :param S: Tuple of shares for each signer. Must include player's private x-share and y-shares received from all other signers. :type S: tuple :return: 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. :rtype: dict .. py:method:: sign_share(S) Create signing shares. :param S: 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. :type S: tuple :return: 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. :rtype: dict .. py:method:: sign_convert(S) Perform multiplicitive-to-additive (MtA) share conversion with another signer. :param S: 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. :type S: tuple :return: 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. :rtype: dict .. py:method:: 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. :param shares: Tuple of gamma-shares or tuple of s-shares. :type shares: tuple :return: 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. :rtype: dict .. py:method:: sign(M, S) Sign a message. :param M: Message to sign. :type M: bytes :param S: Tuple of shares for each signer. Must include signer's private omicron-share and delta-shares received from other signers. :type shares: tuple :return: Signature share to be combined with all other signers' signature shares. :rtype: dict .. py:method:: verify(M, sig) Verify a signature. :param M: Signed message. :type M: bytes :param sig: Signature. :type sig: dict :return: True if signature is valid; False otherwise. :rtype: bool