Ejemplo n.º 1
0
// Format gives you the partial key in the canonical representation including
// ----BEGIN/END headers.
func (k *PartialKey) String() string {
	b := new(buffer.Buffer)
	k.WriteBuffer(b)
	if b.Error != nil {
		panic(errors.New("invalid partial key: " + b.Error.Error()))
	}

	return HEADER + "\n" + lineWrap(b.String(), 64) + FOOTER + "\n"
}
Ejemplo n.º 2
0
// String returns the public key in the same format as used by ssh
func (p *PublicKey) String() string {
	b := new(buffer.Buffer)

	p.WriteBuffer(b)

	if b.Error != nil {
		panic(errors.New("invalid public key: " + b.Error.Error()))
	}

	return PUBLIC_KEY_TYPE + " " + b.String() + "\n"
}
Ejemplo n.º 3
0
// String produces the line-wrapped base-64 version of the challenge,
// suitable for being passed to NewSignRequest()
func (request *SignRequest) String() string {
	b := new(buffer.Buffer)

	request.WriteBuffer(b)

	if b.Error != nil {
		panic(errors.New("invalid sign request: " + b.Error.Error()))
	}

	return SIGN_REQUEST_HEADER + "\n" + lineWrap(b.String(), 64) + SIGN_REQUEST_FOOTER + "\n"
}