Skip to content

Commit

Permalink
Fix PEM header for generated public and private keys.
Browse files Browse the repository at this point in the history
Omiting the key type in the PEM header of the generated key leaves the
key files malformed which confuses some parsers including openssl.
  • Loading branch information
werwurm committed Sep 6, 2024
1 parent 5f38440 commit 0e4b67b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/provisioning/bootguard/keygen.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func writePrivKeyToFile(k crypto.PrivateKey, f *os.File, password string) error
return fmt.Errorf("unable to marshal the private key: %w", err)
}
bpemBlock := &pem.Block{
Type: "PRIVATE KEY",
Bytes: b,
}
bpem := pem.EncodeToMemory(bpemBlock)
Expand All @@ -128,6 +129,7 @@ func writePubKeyToFile(k crypto.PublicKey, f *os.File) error {
return err
}
bpemBlock := &pem.Block{
Type: "PUBLIC KEY",
Bytes: b,
}
bpem := pem.EncodeToMemory(bpemBlock)
Expand Down

0 comments on commit 0e4b67b

Please sign in to comment.