forked from mirror/jwt
fixes #135 copy/paste error in rsa decoding tools
This commit is contained in:
parent
0ef1a002d3
commit
40bd0f3b48
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue