Skip to content

makeCA() in certs.go saves the wrong ca.key #3

@drtimf

Description

@drtimf

I think there is a cut-and-paste error here:

caPrivKeyPEM := new(bytes.Buffer)
pem.Encode(caPrivKeyPEM, &pem.Block{
	Type:  "RSA PRIVATE KEY",
	Bytes: x509.MarshalPKCS1PrivateKey(caKey),
})
if err := ioutil.WriteFile(path + "ca.key", caPEM.Bytes(), 0644); err != nil {
	log.Printf("Write the CA certificate file error: %v\n", err)
	return nil, nil, err
}

I suspect the caPrivKeyPEM.Bytes() rather than the caPEM.Bytes() should be written to ca.key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions