Skip to content

Commit

Permalink
Simplify FromPemBytes conditional (#197)
Browse files Browse the repository at this point in the history
- Simplify logic. strings.HasSuffix can check both for suffix and for equality
  • Loading branch information
moredure committed Apr 3, 2022
1 parent f5dc865 commit bcc1542
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func FromPemBytes(bytes []byte, password string) (tls.Certificate, error) {
if block.Type == "CERTIFICATE" {
cert.Certificate = append(cert.Certificate, block.Bytes)
}
if block.Type == "PRIVATE KEY" || strings.HasSuffix(block.Type, "PRIVATE KEY") {
if strings.HasSuffix(block.Type, "PRIVATE KEY") {
key, err := unencryptPrivateKey(block, password)
if err != nil {
return tls.Certificate{}, err
Expand Down

0 comments on commit bcc1542

Please sign in to comment.