eddsa

package
v0.0.0-...-5abc84a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MessageLengthSig = 32 + 32

Variables

View Source
var ErrInvalidMessage = errors.New("invalid message")

Functions

func ComputeChallenge

func ComputeChallenge(R *ristretto.Element, groupKey *PublicKey, message []byte) *ristretto.Scalar

ComputeChallenge computes the value H(R, A, M), and assumes nothing about whether M is hashed.

Types

type Public

type Public struct {
	// PartyIDs is a party.Set that represents all parties with a share.
	PartyIDs party.IDSlice

	// Threshold returns the integer which defines the maximum number of parties that may be corrupted
	Threshold party.Size

	// Shares maps ID's to the threshold Shamir shares of the public GroupKey
	Shares map[party.ID]*ristretto.Element

	// GroupKey is the group's public key
	// It is the result of interpolating the Shamir shares at 0
	GroupKey *PublicKey
}

Public holds the public keys generated during a key generation protocol. It also stores the associated party list, the threshold used and the full group key.

func NewPublic

func NewPublic(shares map[party.ID]*ristretto.Element, threshold party.Size) (*Public, error)

NewPublic creates a Public structure given a map of public key shares as ristretto.Element, the threshold used.

func (*Public) Equal

func (s *Public) Equal(s2 *Public) bool

func (*Public) MarshalJSON

func (s *Public) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Public) UnmarshalJSON

func (s *Public) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

PublicKey represents a FROST-Ed25519 verification key.

func NewPublicKeyFromPoint

func NewPublicKeyFromPoint(public *ristretto.Element) *PublicKey

NewPublicKeyFromPoint returns a PublicKey given an ristretto.Element.

func (*PublicKey) Equal

func (pk *PublicKey) Equal(pkOther *PublicKey) bool

Equal returns true if the public key is equal to pk0

func (PublicKey) MarshalJSON

func (pk PublicKey) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*PublicKey) ToEd25519

func (pk *PublicKey) ToEd25519() ed25519.PublicKey

ToEd25519 converts the PublicKey to an ed25519 compatible format

func (*PublicKey) UnmarshalJSON

func (pk *PublicKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*PublicKey) Verify

func (pk *PublicKey) Verify(message []byte, sig *Signature) bool

type SecretShare

type SecretShare struct {
	// ID of the party this SecretShare belongs to
	ID party.ID

	// Secret is the Shamir share of the group's secret key
	Secret ristretto.Scalar

	// Public is the Shamir share of the group's public key
	Public ristretto.Element
}

SecretShare is a share of a secret key computed during the KeyGen protocol.

func NewSecretShare

func NewSecretShare(id party.ID, secret *ristretto.Scalar) *SecretShare

NewSecretShare returns a SecretShare given a party.ID and ristretto.Scalar. It additionally computes the associated public key

func (*SecretShare) Equal

func (sk *SecretShare) Equal(sk2 *SecretShare) bool

func (*SecretShare) MarshalBinary

func (sk *SecretShare) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*SecretShare) MarshalJSON

func (sk *SecretShare) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*SecretShare) UnmarshalBinary

func (sk *SecretShare) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*SecretShare) UnmarshalJSON

func (sk *SecretShare) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Signature

type Signature struct {
	R ristretto.Element
	S ristretto.Scalar
}

Signature represents an EdDSA signature. When converted to bytes with .ToEd25519(), the signature is compatible with the standard ed25519 library.

func (*Signature) BytesAppend

func (sig *Signature) BytesAppend(existing []byte) ([]byte, error)

func (*Signature) Equal

func (sig *Signature) Equal(other interface{}) bool

func (*Signature) MarshalBinary

func (sig *Signature) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Signature) Size

func (sig *Signature) Size() int

func (*Signature) ToEd25519

func (sig *Signature) ToEd25519() []byte

ToEd25519 returns a signature that can be validated by ed25519.Verify.

func (*Signature) UnmarshalBinary

func (sig *Signature) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

Jump to

Keyboard shortcuts

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