schnorr_sign

package
v0.0.0-...-3b8f57b Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2015 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnRetry = 5

How many times a peer tries to connect to another until it works

View Source
var ConnWaitRetry = time.Second * 2

How many time do you wait before trying to connect again

Functions

func ReadHostsJson

func ReadHostsJson(file string) (*config.HostsConfig, error)

Read the tree json file and return the configFileold containing every hosts name

func Run

func Run(app *config.AppConfig, depl *deploy.Config)

Dispatch-function for running either client or server (mode-parameter)

func RunClient

func RunClient(conf *deploy.Config)

func RunServer

func RunServer(hosts *config.HostsConfig, app *config.AppConfig, depl *deploy.Config)

Types

type Ack

type Ack struct {
	Id    int
	Valid bool // flag to tell wether the remote peer is OK or NOT
}

message to send at the end of a "round" or a "setup" to tell wether it's ok or not

type Finish

type Finish struct {
	Id int
}

type Peer

type Peer struct {
	// simple int representing its index in the matrix of peers
	Id int
	// its own IP addr : Port
	Name string
	// contains filtered or unexported fields
}

func NewPeer

func NewPeer(id int, name string, p poly.PolyInfo, isRoot bool) *Peer

NewPeer returns a new peer with its id and the number of peers in the schnorr signature algo TODO verification of string addr:port

func (*Peer) BroadcastSignature

func (p *Peer) BroadcastSignature(s *poly.SchnorrSig) []*poly.SchnorrSig

BroadcastSIgnature will broadcast the given signature to every other peer AND will retrieve the signature of every other peer also !

func (*Peer) ComputeSharedSecret

func (p *Peer) ComputeSharedSecret() *poly.SharedSecret

ComputeSharedSecret will make the exchange of dealers between the peers and will compute the sharedsecret at the end

func (*Peer) ConnectTo

func (p *Peer) ConnectTo(host string) error

ConnectTo will connect to the given host and start the SYN exchange (public key + id)

func (*Peer) ForRemotePeers

func (p *Peer) ForRemotePeers(fn func(RemotePeer))

ForRemotePeers will launch the given function over a go routine for each remotepeer this peer has

func (*Peer) IsRoot

func (p *Peer) IsRoot() bool

func (*Peer) Listen

func (p *Peer) Listen()

func (*Peer) SchnorrSigPeer

func (p *Peer) SchnorrSigPeer(msg []byte)

func (*Peer) SchnorrSigRoot

func (p *Peer) SchnorrSigRoot(msg []byte) *poly.SchnorrSig

SchnorrSigRoot will first generate a random shared secret, then start a new round It will wait for the partial sig of the peers to finally render a SchnorrSig struct

func (*Peer) SendACKs

func (p *Peer) SendACKs()

SendACKS will send an ACK to everyone

func (*Peer) SendAcks

func (p *Peer) SendAcks(rp RemotePeer)

Peer logic after it has syn'd with another peer

func (*Peer) SendToAll

func (p *Peer) SendToAll(data interface{}) error

func (*Peer) SendToPeer

func (p *Peer) SendToPeer(i int, data interface{}) error

Helpers to send any aribtrary data to the n-peer

func (*Peer) SendToRoot

func (p *Peer) SendToRoot(data interface{}) error

func (*Peer) SetupDistributedSchnorr

func (p *Peer) SetupDistributedSchnorr()

SetupDistributedSchnorr will compute a shared secret in order to be able to use the schnorr t-n distributed algo

func (*Peer) String

func (p *Peer) String() string

func (*Peer) VerifySchnorrSig

func (p *Peer) VerifySchnorrSig(ps *poly.SchnorrSig, msg []byte) error

VerifySchnorrSig will basically verify the validity of the issued signature

func (*Peer) WaitACKs

func (p *Peer) WaitACKs()

WaitAcks will make a peer waits for all others peers to send an ACK to it

func (*Peer) WaitFins

func (p *Peer) WaitFins()

Wait for the end of the alo so we can close connection nicely

func (*Peer) WaitSYNs

func (p *Peer) WaitSYNs()

WaitSYNs will wait until every peers has syn'd with this one

type RemotePeer

type RemotePeer struct {
	// its connection
	Conn net.Conn
	// its name
	Hostname string
	// its id
	Id int
}

func (*RemotePeer) IsRoot

func (r *RemotePeer) IsRoot() bool

func (*RemotePeer) String

func (r *RemotePeer) String() string

type Syn

type Syn struct {
	Id     int
	Public abstract.Point
}

message to send at the beginning of a connection to tell the remote peer our ID and our public key (Basic knowledge)

Jump to

Keyboard shortcuts

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