Example #1
0
func NewRoundStamper(node *sign.Node) *RoundStamper {
	dbg.Lvl3("Making new RoundStamper", node.Name())
	round := &RoundStamper{}
	round.RoundCosi = sign.NewRoundCosi(node)
	round.Type = RoundStamperType
	return round
}
Example #2
0
func writeHC(b *bytes.Buffer, hc *HostConfig, p *sign.Node) error {
	// Node{name, pubkey, x_hat, children}
	if p == nil {
		return errors.New("node does not exist")
	}
	prk, _ := p.PrivKey.MarshalBinary()
	pbk, _ := p.PubKey.MarshalBinary()
	fmt.Fprint(b, "{\"name\":", "\""+p.Name()+"\",")
	fmt.Fprint(b, "\"prikey\":", "\""+string(hex.EncodeToString(prk))+"\",")
	fmt.Fprint(b, "\"pubkey\":", "\""+string(hex.EncodeToString(pbk))+"\",")

	// recursively format children
	fmt.Fprint(b, "\"children\":[")
	i := 0
	for _, n := range p.Children(0) {
		if i != 0 {
			b.WriteString(", ")
		}
		c := hc.Hosts[n.Name()]
		err := writeHC(b, hc, c)
		if err != nil {
			b.WriteString("\"" + n.Name() + "\"")
		}
		i++
	}
	fmt.Fprint(b, "]}")
	return nil
}
Example #3
0
// Your New Round function
func NewRoundSkeleton(node *sign.Node) *RoundSkeleton {
	dbg.Lvl3("Making new RoundSkeleton", node.Name())
	round := &RoundSkeleton{}
	// You've got to initialize the roundcosi with the node
	round.RoundCosi = sign.NewRoundCosi(node)
	round.Type = RoundSkeletonType
	return round
}
Example #4
0
func NewRoundStamperListener(node *sign.Node) *RoundStamperListener {
	dbg.Lvl3("Making new RoundStamperListener", node.Name())
	round := &RoundStamperListener{}
	round.StampListener = NewStampListener(node.Name())
	round.RoundStamper = NewRoundStamper(node)
	round.Type = RoundStamperListenerType
	return round
}
Example #5
0
func NewRoundSwsign(node *sign.Node) *RoundSwsign {
	dbg.Lvl3("Making new RoundSwsign", node.Name())
	round := &RoundSwsign{}
	round.RoundStruct = sign.NewRoundStruct(node, RoundSwsignType)
	// If you're sub-classing from another round-type, don't forget to remove
	// the above line, call the constructor of your parent round and add
	round.RoundException = sign.NewRoundException(node)
	round.Signature = make(chan sign.SignatureBroadcastMessage, 1)
	round.Type = RoundSwsignType
	return round
}