config

package
v0.6.0-alpha-2021-09-21 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 14 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidThreshold

func ValidThreshold(t, n int) bool

Types

type Config

type Config struct {
	// Group returns the Elliptic Curve Group associated with this config.
	Group curve.Curve
	// ID is the identifier of the party this Config belongs to.
	ID party.ID
	// Threshold is the integer t which defines the maximum number of corruptions tolerated for this config.
	// Threshold + 1 is the minimum number of parties' shares required to reconstruct the secret/sign a message.
	Threshold int
	// ECDSA is this party's share xᵢ of the secret ECDSA x.
	ECDSA curve.Scalar
	// ElGamal is this party's yᵢ used for ElGamal.
	ElGamal curve.Scalar
	// Paillier is this party's Paillier decryption key.
	Paillier *paillier.SecretKey
	// RID is a 32 byte random identifier generated for this config
	RID types.RID
	// ChainKey is the chaining key value associated with this public key
	ChainKey types.RID
	// Public maps party.ID to public. It contains all public information associated to a party.
	Public map[party.ID]*Public
}

Config contains all necessary cryptographic keys necessary to generate a signature. It also represents the `SSID` after having performed a keygen/refresh operation. where SSID = (𝔾, t, n, P₁, …, Pₙ, (X₁, Y₁, N₁, s₁, t₁), …, (Xₙ, Yₙ, Nₙ, sₙ, tₙ)).

To unmarshal this struct, EmptyConfig should be called first with a specific group, before using cbor.Unmarshal with that struct.

func EmptyConfig

func EmptyConfig(group curve.Curve) *Config

EmptyConfig creates an empty Config with a fixed group, ready for unmarshalling.

This needs to be used for unmarshalling, otherwise the points on the curve can't be decoded.

func (*Config) CanSign

func (c *Config) CanSign(signers party.IDSlice) bool

CanSign returns true if the given _sorted_ list of signers is a valid subset of the original parties of size > t, and includes self.

func (*Config) Derive

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

Derive adds adjust to the private key, resulting in a new key pair.

This supports arbitrary derivation methods, including BIP32. For explicit BIP32 support, see DeriveBIP32.

A new chain key can be passed, which will replace the existing one for the new keypair.

func (*Config) DeriveBIP32

func (c *Config) DeriveBIP32(i uint32) (*Config, error)

DeriveBIP32 derives a sharing of the ith child of the consortium signing key.

This function uses unhardened derivation, deriving a key without including the underlying private key. This function will panic if i ⩾ 2³¹, since that indicates a hardened key.

Sometimes, an error will be returned, indicating that this index generates an invalid key.

See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

func (*Config) Domain

func (c *Config) Domain() string

Domain implements hash.WriterToWithDomain.

func (*Config) MarshalBinary

func (c *Config) MarshalBinary() ([]byte, error)

func (*Config) PartyIDs

func (c *Config) PartyIDs() party.IDSlice

PartyIDs returns a sorted slice of party IDs.

func (*Config) PublicPoint

func (c *Config) PublicPoint() curve.Point

PublicPoint returns the group's public ECC point.

func (*Config) UnmarshalBinary

func (c *Config) UnmarshalBinary(data []byte) error

func (*Config) WriteTo

func (c *Config) WriteTo(w io.Writer) (total int64, err error)

WriteTo implements io.WriterTo interface.

type Public

type Public struct {
	// ECDSA public key share
	ECDSA curve.Point
	// ElGamal is this party's public key for ElGamal encryption.
	ElGamal curve.Point
	// Paillier is this party's public Paillier key.
	Paillier *paillier.PublicKey
	// Pedersen is this party's public Pedersen parameters.
	Pedersen *pedersen.Parameters
}

Public holds public information for a party.

func (Public) Domain

func (Public) Domain() string

Domain implements hash.WriterToWithDomain.

func (*Public) WriteTo

func (p *Public) WriteTo(w io.Writer) (total int64, err error)

WriteTo implements io.WriterTo interface.

Jump to

Keyboard shortcuts

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