From 19136823e1bd2284562ce4e2073fd27bd1230a1b Mon Sep 17 00:00:00 2001 From: Gibheer Date: Sat, 11 Jul 2015 07:48:10 +0200 Subject: [PATCH] implement rsa public key This finally adds support for the rsa public key. --- rsa.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rsa.go b/rsa.go index 11a770b..6622887 100644 --- a/rsa.go +++ b/rsa.go @@ -63,7 +63,13 @@ func (pr RsaPrivateKey) MarshalPem() (io.WriterTo, error) { // restore a rsa public key func LoadPublicKeyRsa(raw []byte) (*RsaPublicKey, error) { - return nil, errors.New("not implemented yet!") + pub := &RsaPublicKey{} + if pub_raw, err := x509.ParsePKIXPublicKey(raw); err != nil { + return nil, err + } else { + pub.public_key = pub_raw.(*rsa.PublicKey) + } + return pub, nil } // marshal a rsa public key into pem format