Skip to content

Commit

Permalink
cmd/dkim-milter: add support for PKCS #8 keys
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Oct 27, 2020
1 parent 407ce64 commit 4ac38eb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/dkim-milter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ func loadPrivateKey(path string) (crypto.Signer, error) {
}

switch strings.ToUpper(block.Type) {
case "PRIVATE KEY":
k, err := x509.ParsePKCS8PrivateKey(block.Bytes)
if err != nil {
return nil, err
}
return k.(crypto.Signer), nil
case "RSA PRIVATE KEY":
return x509.ParsePKCS1PrivateKey(block.Bytes)
case "EDDSA PRIVATE KEY":
Expand Down

0 comments on commit 4ac38eb

Please sign in to comment.