Beispiel #1
0
func (rc *RegCred) String() string {

	// Ignore possible errors; the values in this data structure
	// should have already been checked.
	ck_, _ := xc.RSAPubKeyToDisk(rc.CommsPubKey)
	sk_, _ := xc.RSAPubKeyToDisk(rc.SigPubKey)
	ck := string(ck_)
	sk := string(sk_)

	// XXX Space after the colon is strictly required
	ss := []string{"regCred {"}
	ss = append(ss, "    Name: "+rc.Name)
	ss = append(ss, "    ID: "+rc.ID.String())
	ss = append(ss, "    CommsPubKey: "+ck)
	ss = append(ss, "    SigPubKey: "+sk)
	ss = append(ss, "    EndPoints {")

	for i := 0; i < len(rc.EndPoints); i++ {
		ss = append(ss, "         "+rc.EndPoints[i].String())
	}
	ss = append(ss, "    }")
	ss = append(ss, "    Version: "+rc.Version.String())
	ss = append(ss, "}")
	return strings.Join(ss, "\r\n") + "\r\n"
}
Beispiel #2
0
func (dl *DigiList) Strings() (ss []string) {

	skSSH, err := xc.RSAPubKeyToDisk(dl.sk)
	if err != nil {
		panic(err)
	}
	ss = append(ss, fmt.Sprintf("sk: %s", skSSH))
	ss = append(ss, fmt.Sprintf("title: %s", dl.title))
	ss = append(ss, fmt.Sprintf("timestamp: %s", dl.timestamp.String()))
	ss = append(ss, fmt.Sprintf("digSig: %s",
		base64.StdEncoding.EncodeToString(dl.digSig)))

	return
}
Beispiel #3
0
/**
 * Return the document header as a slice of strings, dropping CRLF
 * line terminators.
 *
 * If any error is encountered, this function silently returns an empty string.
 *
 * PANICS if sl.PubKey is nil.
 */
func (sl *SignedBList) Strings() (title, timestamp, pk string) {

	// title ------------------------------------------
	title = sl.Title

	// timestamp --------------------------------------
	timestamp = sl.Timestamp.String()

	// public key to SSH format -----------------------
	pkBytes, _ := xc.RSAPubKeyToDisk(sl.PubKey) // is newline-terminated
	pk = string(pkBytes)

	return
}