Skip to content

Commit

Permalink
Cope with PKCS#8 private key forms
Browse files Browse the repository at this point in the history
  • Loading branch information
lwithers committed Sep 13, 2024
1 parent d3160fc commit e1695ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ func packKeypair(opts *jks.Options, dir string) (*jks.Keypair, error) {

block, err := packLoadPem(fname)
switch block.Type {
case "PRIVATE KEY":
kp.PrivateKey, err = x509.ParsePKCS8PrivateKey(block.Bytes)

case "RSA PRIVATE KEY":
kp.PrivateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)

Expand Down

0 comments on commit e1695ab

Please sign in to comment.