Skip to content

Commit

Permalink
Theme locationush
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielopesantos committed Apr 8, 2022
1 parent 1c140cc commit de624f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func parsePrivateKey(privKey, password string) ([]byte, error) {
return nil, fmt.Errorf("failed to decode PEM key")
}
blockType := block.Type
if blockType == "ENCRYPTED PRIVATE KEY" {
return nil, fmt.Errorf("encrypted pkcs8 formatted key is not supported")
}
if encrypted := x509.IsEncryptedPEMBlock(block); encrypted {
decryptedKey, err := x509.DecryptPEMBlock(block, []byte(password))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion lib/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func TestOptions(t *testing.T) {
assert.NoError(t, err)

var opts2 Options
errMsg := "tls: failed to parse private key"
errMsg := "encrypted pkcs8 formatted key is not supported"
err = json.Unmarshal(optsData, &opts2)
assert.Error(t, err)
assert.Contains(t, err.Error(), errMsg)
Expand Down

0 comments on commit de624f1

Please sign in to comment.