signing

package
v0.0.0-...-1e2cef0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: GPL-2.0, GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package signing ED MPC implementation of signing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalKValue

func CalKValue(keyType string, message, pkFinal, RFinal []byte) ([32]byte, error)

for ed25519 and sr25519, calculate the challenge k

func CheckFull

func CheckFull(msg []smpc.Message) bool

CheckFull Check for empty messages

func EdVerify

func EdVerify(input InputVerify, sigtype string) bool

EdVerify check (R,S)

func NewLocalDNode

func NewLocalDNode(
	out chan<- smpc.Message,
	end chan<- EdSignData,
	save *keygen.LocalDNodeSaveData,
	idsign smpc.SortableIDSSlice,
	kgid *big.Int,
	threshold int,
	paillierkeylength int,
	finalize bool,
	predata *PrePubData,
	txhash *big.Int,
	cointype string,
	finalizeend chan<- *big.Int,
) smpc.DNode

NewLocalDNode new a DNode data struct for current node

Types

type EdSignData

type EdSignData struct {
	Rx [32]byte
	Sx [32]byte
}

EdSignData ed sign result (r,s)

type InputVerify

type InputVerify struct {
	KeyType string
	FinalR  [32]byte
	FinalS  [32]byte
	Message []byte
	FinalPk [32]byte
}

InputVerify Ed algorithm validation data

type LocalDNode

type LocalDNode struct {
	*smpc.BaseDNode
	// contains filtered or unexported fields
}

LocalDNode current local node

func (*LocalDNode) DNodeID

func (p *LocalDNode) DNodeID() string

DNodeID get the ID of current DNode

func (*LocalDNode) DulMessage

func (p *LocalDNode) DulMessage(msg smpc.Message) bool

DulMessage check whether the msg already exists in the list.

func (*LocalDNode) Finalize

func (p *LocalDNode) Finalize() bool

Finalize weather gg20 round

func (*LocalDNode) FinalizeRound

func (p *LocalDNode) FinalizeRound() smpc.Round

FinalizeRound get finalize round

func (*LocalDNode) FirstRound

func (p *LocalDNode) FirstRound() smpc.Round

FirstRound first round

func (*LocalDNode) SetDNodeID

func (p *LocalDNode) SetDNodeID(id string)

SetDNodeID set the ID of current DNode p.ID : enode --> DoubleHash --> index+1 --> Sprintf(index+1) --> []byte( Sprintf(index+1) ) --> EncodeToString *big.Int format: index+1 string format: EncodeToString

func (*LocalDNode) Start

func (p *LocalDNode) Start() error

Start ed signing start

func (*LocalDNode) StoreMessage

func (p *LocalDNode) StoreMessage(msg smpc.Message) (bool, error)

StoreMessage Collect data from other nodes

func (*LocalDNode) Update

func (p *LocalDNode) Update(msg smpc.Message) (ok bool, err error)

Update Collect data from other nodes and enter the next round

type PrePubData

type PrePubData struct {
	K1     *big.Int
	R      *big.Int
	Ry     *big.Int
	Sigma1 *big.Int
}

PrePubData pre-sign data

type SignRound1Message

type SignRound1Message struct {
	*SignRoundMessage
	CR [32]byte
}

SignRound1Message Round 1 sending message

func (*SignRound1Message) GetFromID

func (srm *SignRound1Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound1Message) GetFromIndex

func (srm *SignRound1Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound1Message) GetMsgType

func (srm *SignRound1Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound1Message) GetToID

func (srm *SignRound1Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound1Message) IsBroadcast

func (srm *SignRound1Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound1Message) OutMap

func (srm *SignRound1Message) OutMap() map[string]string

OutMap transfer *SignRound1Message to map

type SignRound2Message

type SignRound2Message struct {
	*SignRoundMessage
	ZkR [64]byte
}

SignRound2Message Round 2 sending message

func (*SignRound2Message) GetFromID

func (srm *SignRound2Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound2Message) GetFromIndex

func (srm *SignRound2Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound2Message) GetMsgType

func (srm *SignRound2Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound2Message) GetToID

func (srm *SignRound2Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound2Message) IsBroadcast

func (srm *SignRound2Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound2Message) OutMap

func (srm *SignRound2Message) OutMap() map[string]string

OutMap transfer *SignRound2Message to map

type SignRound3Message

type SignRound3Message struct {
	*SignRoundMessage
	DR [64]byte
}

SignRound3Message Round 3 sending message

func (*SignRound3Message) GetFromID

func (srm *SignRound3Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound3Message) GetFromIndex

func (srm *SignRound3Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound3Message) GetMsgType

func (srm *SignRound3Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound3Message) GetToID

func (srm *SignRound3Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound3Message) IsBroadcast

func (srm *SignRound3Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound3Message) OutMap

func (srm *SignRound3Message) OutMap() map[string]string

OutMap transfer *SignRound3Message to map

type SignRound4Message

type SignRound4Message struct {
	*SignRoundMessage
	CSB [32]byte
}

SignRound4Message Round 4 sending message

func (*SignRound4Message) GetFromID

func (srm *SignRound4Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound4Message) GetFromIndex

func (srm *SignRound4Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound4Message) GetMsgType

func (srm *SignRound4Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound4Message) GetToID

func (srm *SignRound4Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound4Message) IsBroadcast

func (srm *SignRound4Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound4Message) OutMap

func (srm *SignRound4Message) OutMap() map[string]string

OutMap transfer *SignRound4Message to map

type SignRound5Message

type SignRound5Message struct {
	*SignRoundMessage
	DSB [64]byte
}

SignRound5Message Round 5 sending message

func (*SignRound5Message) GetFromID

func (srm *SignRound5Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound5Message) GetFromIndex

func (srm *SignRound5Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound5Message) GetMsgType

func (srm *SignRound5Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound5Message) GetToID

func (srm *SignRound5Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound5Message) IsBroadcast

func (srm *SignRound5Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound5Message) OutMap

func (srm *SignRound5Message) OutMap() map[string]string

OutMap transfer *SignRound5Message to map

type SignRound6Message

type SignRound6Message struct {
	*SignRoundMessage
	S [32]byte
}

SignRound6Message Round 6 sending message

func (*SignRound6Message) GetFromID

func (srm *SignRound6Message) GetFromID() string

GetFromID get the ID of sending nodes in the group

func (*SignRound6Message) GetFromIndex

func (srm *SignRound6Message) GetFromIndex() int

GetFromIndex get the Serial number of sending nodes in the group

func (*SignRound6Message) GetMsgType

func (srm *SignRound6Message) GetMsgType() string

GetMsgType get msg type

func (*SignRound6Message) GetToID

func (srm *SignRound6Message) GetToID() []string

GetToID get the ID of the node that broacasting message to

func (*SignRound6Message) IsBroadcast

func (srm *SignRound6Message) IsBroadcast() bool

IsBroadcast weather broacast the message

func (*SignRound6Message) OutMap

func (srm *SignRound6Message) OutMap() map[string]string

OutMap transfer *SignRound6Message to map

type SignRoundMessage

type SignRoundMessage struct {
	FromID    string   `json:"FromID"` //DNodeID
	FromIndex int      `json:"FromIndex"`
	ToID      []string `json:"ToID"`
}

SignRoundMessage base type of sign round message

func (*SignRoundMessage) AppendToID

func (srm *SignRoundMessage) AppendToID(toid string)

AppendToID get the ID of nodes that the message will broacast to

func (*SignRoundMessage) SetFromID

func (srm *SignRoundMessage) SetFromID(id string)

SetFromID set sending nodes's ID

func (*SignRoundMessage) SetFromIndex

func (srm *SignRoundMessage) SetFromIndex(index int)

SetFromIndex set sending nodes's serial number in group

Jump to

Keyboard shortcuts

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