fixes #135 copy/paste error in rsa decoding tools

This commit is contained in:
Dave Grijalva 2016-05-04 10:25:48 -07:00
parent 0ef1a002d3
commit 40bd0f3b48
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
var ( var (
ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key")
ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key")
ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key")
) )
// Parse PEM encoded PKCS1 or PKCS8 private key // Parse PEM encoded PKCS1 or PKCS8 private key
@ -61,7 +62,7 @@ func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
var pkey *rsa.PublicKey var pkey *rsa.PublicKey
var ok bool var ok bool
if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
return nil, ErrNotRSAPrivateKey return nil, ErrNotRSAPublicKey
} }
return pkey, nil return pkey, nil