Skip to content

Commit

Permalink
Write private key in accordance with Asymmetric Key Packages RFC (#144)
Browse files Browse the repository at this point in the history
The key is marshaled using [MarshalPKCS8PrivateKey](https://pkg.go.dev/crypto/x509#MarshalPKCS8PrivateKey) which suggests the "PRIVATE KEY" PEM block type, and [Asymmetric Key Packages RFC](https://datatracker.ietf.org/doc/html/rfc5958) states:
> When .p8 files are PEM encoded they use the .pem file extension. PEM encoding is ... Base64 encoding, see Section 4 of [RFC4648], of the DER-encoded PrivateKeyInfo sandwiched between:
>   -----BEGIN PRIVATE KEY-----
>   -----END PRIVATE KEY-----

Signed-off-by: Aliaksei Shainiuk <[email protected]>
  • Loading branch information
iron-s authored Mar 13, 2024
1 parent ff0f821 commit 95b0e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/disk/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func writeCerts(file string, certs []*x509.Certificate) error {
// formats as PEM, and writes it to file
func writeKey(file string, data []byte) error {
b := &pem.Block{
Type: "EC PRIVATE KEY",
Type: "PRIVATE KEY",
Bytes: data,
}

Expand Down

0 comments on commit 95b0e53

Please sign in to comment.