コード例 #1
0
ファイル: roundcosi.go プロジェクト: mlncn/cothority
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
ファイル: round_swsign.go プロジェクト: nikirill/cothority
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)
}