diff options
author | Gibheer <gibheer@gmail.com> | 2015-07-11 07:48:10 +0200 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-07-11 07:48:10 +0200 |
commit | 19136823e1bd2284562ce4e2073fd27bd1230a1b (patch) | |
tree | ebcd2f5ea734eb9ebe72b7cbc7c7650179231706 /rsa.go | |
parent | 1fa31fbdee9dc63010be2a2ae41fc5e0f9e967b0 (diff) |
implement rsa public key
This finally adds support for the rsa public key.
Diffstat (limited to 'rsa.go')
-rw-r--r-- | rsa.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 |