cosi

package
v0.0.0-...-6588121 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: GPL-3.0, LGPL-3.0, AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cosi implements a round of a Collective Signing protocol.

Index

Constants

View Source
const (
	// AnnouncementPhase is the ID of the Announcement message
	AnnouncementPhase uint32 = 1
	// CommitmentPhase  is the ID of the Commitment message
	CommitmentPhase = 2
	// ChallengePhase is the ID of the Challenge message
	ChallengePhase = 3
	// ResponsePhase is the ID of the Response message
	ResponsePhase = 4
)

Variables

View Source
var Name = "CoSi"

Name can be used to reference the registered protocol.

ProtocolPacketID is the network.PacketTypeID of the CoSi ProtocolPacket

Functions

func NewProtocol

func NewProtocol(node *onet.TreeNodeInstance) (onet.ProtocolInstance, error)

NewProtocol returns a ProtocolCosi with the node set with the right channels. Use this function like this: ``` round := NewRound****()

fn := func(n *onet.Node) onet.ProtocolInstance {
     pc := NewProtocolCosi(round,n)
		return pc
}

onet.RegisterNewProtocolName("cothority",fn) ```

func VerifySignature

func VerifySignature(suite kyber.Group, publics []kyber.Point, msg, sig []byte) error

VerifySignature verifies if the challenge and the secret (from the response phase) form a correct signature for this message using the aggregated public key. This is copied from cosi, so that you don't need to include both lib/cosi and protocols/cosi

Types

type Announcement

type Announcement struct {
}

Announcement is sent down the tree to start the collective signature.

type AnnouncementHook

type AnnouncementHook func() error

AnnouncementHook allows for handling what should happen upon an announcement

type Challenge

type Challenge struct {
	Chall kyber.Scalar
}

Challenge is the challenge against the aggregate commitment.

type ChallengeHook

type ChallengeHook func(ch kyber.Scalar) error

ChallengeHook allows for handling what should happen when a challenge is received

type CoSi

type CoSi struct {
	// The node that represents us
	*onet.TreeNodeInstance

	// the message we want to sign typically given by the Root
	Message []byte
	// contains filtered or unexported fields
}

CoSi is the main structure holding the round and the onet.Node.

func (*CoSi) Dispatch

func (c *CoSi) Dispatch() error

Dispatch will listen on the four channels we use (i.e. four steps)

func (*CoSi) RegisterAnnouncementHook

func (c *CoSi) RegisterAnnouncementHook(fn AnnouncementHook)

RegisterAnnouncementHook allows for handling what should happen upon an announcement

func (*CoSi) RegisterChallengeHook

func (c *CoSi) RegisterChallengeHook(fn ChallengeHook)

RegisterChallengeHook allows for handling what should happen when a challenge is received

func (*CoSi) RegisterCommitmentHook

func (c *CoSi) RegisterCommitmentHook(fn CommitmentHook)

RegisterCommitmentHook allows for handling what should happen when a commitment is received

func (*CoSi) RegisterResponseHook

func (c *CoSi) RegisterResponseHook(fn ResponseHook)

RegisterResponseHook allows for handling what should happen when a response is received

func (*CoSi) RegisterSignatureHook

func (c *CoSi) RegisterSignatureHook(fn SignatureHook)

RegisterSignatureHook allows for handling what should happen when the protocol is done

func (*CoSi) SigningMessage

func (c *CoSi) SigningMessage(msg []byte)

SigningMessage simply set the message to sign for this round

func (*CoSi) Start

func (c *CoSi) Start() error

Start will call the announcement function of its inner Round structure. It will pass nil as *in* message.

func (*CoSi) VerifyResponses

func (c *CoSi) VerifyResponses(agg kyber.Point) error

VerifyResponses allows to check at each intermediate node whether the responses are valid

type Commitment

type Commitment struct {
	Comm kyber.Point
}

Commitment of all nodes, aggregated over all children.

type CommitmentHook

type CommitmentHook func(in []kyber.Point) error

CommitmentHook allows for handling what should happen when all commitments are received

type MessageProxy

type MessageProxy struct{}

MessageProxy implements the onet.MessageProxy interface for the CoSi protocol.

func (*MessageProxy) Name

func (p *MessageProxy) Name() string

Name implements the onet.MessageProxy interface by returning the name under which cosi.MessageProxy is registered.

func (*MessageProxy) PacketType

func (p *MessageProxy) PacketType() network.MessageTypeID

PacketType implements the onet.MessageProxy interface by returning the type of the ProtocolPacket.

func (*MessageProxy) Unwrap

func (p *MessageProxy) Unwrap(msg interface{}) (interface{}, *onet.OverlayMsg, error)

Unwrap implements the onet.MessageProxy interface by unwraping and returning the specific message of one of the four steps.

func (*MessageProxy) Wrap

func (p *MessageProxy) Wrap(msg interface{}, info *onet.OverlayMsg) (interface{}, error)

Wrap implements the onet.MessageProxy interface by wrapping up any of the four-step messages into a ProtooclPacket.

type ProtocolPacket

type ProtocolPacket struct {
	Phase uint32

	OverlayMessage *onet.OverlayMsg

	Ann  *Announcement
	Comm *Commitment
	Chal *Challenge
	Resp *Response
}

ProtocolPacket is the main message for the CoSi protocol which includes every information that the CoSi protocol might need.

type Response

type Response struct {
	Resp kyber.Scalar
}

Response of all nodes, aggregated over all children.

type ResponseHook

type ResponseHook func(in []kyber.Scalar)

ResponseHook allows for handling what should happen when all responses are received and our response is calculated

type SignatureHook

type SignatureHook func(sig []byte)

SignatureHook allows registering a handler when the signature is done

Jump to

Keyboard shortcuts

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