keygen_gennaro

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartKeygenCommonGennaro

func StartKeygenCommonGennaro(taproot bool, group curve.Curve, participants []party.ID, threshold int, selfID party.ID, privateShare curve.Scalar, publicKey curve.Point, verificationShares map[party.ID]curve.Point) protocol.StartFunc

This starts a DKG based on Gennaro's protocol.

Types

type Config

type Config struct {
	// ID is the identifier for this participant.
	ID party.ID
	// Threshold is the number of accepted corruptions while still being able to sign.
	Threshold int
	// PrivateShare is the fraction of the secret key owned by this participant.
	PrivateShare curve.Scalar
	// PublicKey is the shared public key for this consortium of signers.
	//
	// This key can be used to verify signatures produced by the consortium.
	PublicKey curve.Point
	// ChainKey is the additional randomness we've agreed upon.
	//
	// This is only ever useful if you do BIP-32 key derivation, or something similar.
	ChainKey []byte
	// VerificationShares is a map between parties and a commitment to their private share.
	//
	// This will later be used to verify the integrity of the signing protocol.
	VerificationShares *party.PointMap
}

Config contains all the information produced after key generation, from the perspective of a single participant.

When unmarshalling, EmptyResult needs to be called to set the group, before calling cbor.Unmarshal, or equivalent methods.

func EmptyConfig

func EmptyConfig(group curve.Curve) *Config

EmptyConfig creates an empty Result with a specific group.

This needs to be called before unmarshalling, instead of just using new(Result). This is to allow points and scalars to be correctly unmarshalled.

func (*Config) Curve

func (r *Config) Curve() curve.Curve

Curve returns the Elliptic Curve Group associated with this result.

func (*Config) Derive

func (r *Config) Derive(adjust curve.Scalar, newChainKey []byte) (*Config, error)

Derive performs an arbitrary derivation of a related key, by adding a scalar.

This can support methods like BIP32, but is more general.

Optionally, a new chain key can be passed as well.

func (*Config) DeriveChild

func (r *Config) DeriveChild(i uint32) (*Config, error)

DeriveChild adjusts the shares to represent the derived public key at a certain index.

This will panic if the group is not curve.Secp256k1

This derivation works according to BIP-32, see: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

type TaprootConfig

type TaprootConfig struct {
	// ID is the identifier for this participant.
	ID party.ID
	// Threshold is the number of accepted corruptions while still being able to sign.
	Threshold int
	// PrivateShare is the fraction of the secret key owned by this participant.
	PrivateShare *curve.Secp256k1Scalar
	// PublicKey is the shared public key for this consortium of signers.
	//
	// This key can be used to verify signatures produced by the consortium.
	PublicKey taproot.PublicKey
	// ChainKey is the additional randomness we've agreed upon.
	//
	// This is only ever useful if you do BIP-32 key derivation, or something similar.
	ChainKey []byte
	// VerificationShares is a map between parties and a commitment to their private share.
	//
	// This will later be used to verify the integrity of the signing protocol.
	VerificationShares map[party.ID]*curve.Secp256k1Point
}

TaprootConfig is like result, but for Taproot / BIP-340 keys.

The main difference is that our public key is an actual taproot public key.

func (*TaprootConfig) Clone

func (r *TaprootConfig) Clone() *TaprootConfig

Clone creates a deep clone of this struct, and all the values contained inside

func (*TaprootConfig) Derive

func (r *TaprootConfig) Derive(adjust *curve.Secp256k1Scalar, newChainKey []byte) (*TaprootConfig, error)

Derive performs an arbitrary derivation of a related key, by adding a scalar.

This can support methods like BIP32, but is more general.

Optionally, a new chain key can be passed as well.

func (*TaprootConfig) DeriveChild

func (r *TaprootConfig) DeriveChild(i uint32) (*TaprootConfig, error)

DeriveChild adjusts the shares to represent the derived public key at a certain index.

This derivation works according to BIP-32, see: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

Note that to do this derivation, we interpret the Taproot key as an "old" ECDSA key, with the y coordinate byte set to 0x02. We also only look at the x coordinate of the derived public key, making sure that the corresponding secret key matches the version of this point with an even y coordinate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL