Skip to content

Commit

Permalink
Ensure passing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Anderson committed Nov 6, 2021
1 parent 6296976 commit 327371d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rsa_utils.go
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
)

var (
Expand Down Expand Up @@ -91,8 +92,8 @@ func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
parsedKey = cert.PublicKey
} else {
if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err == nil {
return nil, err
if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil {
return nil, fmt.Errorf("%v - %w", ErrNotRSAPublicKey.Error(), err)
}
}
}
Expand Down

0 comments on commit 327371d

Please sign in to comment.