0
0
Fork 0

implement rsa public key

This finally adds support for the rsa public key.
This commit is contained in:
Gibheer 2015-07-11 07:48:10 +02:00
parent 1fa31fbdee
commit 19136823e1
1 changed files with 7 additions and 1 deletions

8
rsa.go
View File

@ -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