示例#1
0
func (round *RoundCosi) CheckChildren() {
	c := round.Node.Children(round.Node.ViewNo)
	if len(c) != len(round.Cosi.Children) {
		dbg.Print("Children in cosi and node are different")
		dbg.Printf("round.Cosi: %+v", round.Cosi)
		dbg.Printf("Node.Children: %+v", round.Node.Children(round.Node.ViewNo))
		dbg.Print("viewNbr:", round.SaveViewNo, "Node.ViewNo:", round.Node.ViewNo)
		debug.PrintStack()
	}
}
示例#2
0
func (round *RoundSwsign) SignatureBroadcast(in *sign.SigningMessage, out []*sign.SigningMessage) error {
	err := round.RoundException.SignatureBroadcast(in, out)
	if round.IsRoot {
		dbg.Print("Broadcasting signature")
		round.Signature <- *in.SBm
	}
	return err
}
示例#3
0
文件: stamp.go 项目: mlncn/cothority
// Verify signature takes a file name and the name of the signature file
// if signature file is empty ( sigFile == ""), then the signature file is
// simply the name of the file appended with ".sig" extension.
func VerifyFileSignature(file, sigFile string) bool {
	if file == "" {
		dbg.Fatal("Can not verify anything with an empty file name !")
	}

	// by default
	if sigFile == "" {
		sigFile = file + sigExtension
	}
	// read the sig
	signature := conode.StampSignature{
		SuiteStr: suite.String(),
	}
	if err := signature.Open(sigFile); err != nil {
		dbg.Fatal("Couldn't read signature-file", sigFile, ":", err)
	}
	hash := hashFile(file)
	dbg.Print(base64.StdEncoding.EncodeToString(hash))
	// Then verify the proper signature
	return conode.VerifySignature(suite, &signature, public_X0, hash)
}