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.

Signed-off-by: Janis Danisevskis <[email protected]>
  • Loading branch information
werwurm committed Sep 9, 2024
1 parent 5f38440 commit 8693fb6
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 8693fb6

Please sign in to comment.