Skip to content

Commit 327371d

Browse files
author
Tom Anderson
committed
Ensure passing unit tests
1 parent 6296976 commit 327371d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rsa_utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/x509"
66
"encoding/pem"
77
"errors"
8+
"fmt"
89
)
910

1011
var (
@@ -91,8 +92,8 @@ func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
9192
if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
9293
parsedKey = cert.PublicKey
9394
} else {
94-
if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err == nil {
95-
return nil, err
95+
if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil {
96+
return nil, fmt.Errorf("%v - %w", ErrNotRSAPublicKey.Error(), err)
9697
}
9798
}
9899
}

0 commit comments

Comments
 (0)