Example #1
0
File: rsa.go Project: rht/bssim
func (sk *RsaPrivateKey) Bytes() ([]byte, error) {
	b := x509.MarshalPKCS1PrivateKey(sk.sk)
	pbmes := new(pb.PrivateKey)
	typ := pb.KeyType_RSA
	pbmes.Type = &typ
	pbmes.Data = b
	return proto.Marshal(pbmes)
}
Example #2
0
File: key.go Project: rht/bssim
// MarshalPrivateKey converts a key object into its protobuf serialized form.
func MarshalPrivateKey(k PrivKey) ([]byte, error) {
	b := MarshalRsaPrivateKey(k.(*RsaPrivateKey))
	pmes := new(pb.PrivateKey)
	typ := pb.KeyType_RSA // for now only type.
	pmes.Type = &typ
	pmes.Data = b
	return proto.Marshal(pmes)
}