Skip to content

Commit

Permalink
transport/ca/localca: remove unused testGenerateKeypair utility
Browse files Browse the repository at this point in the history
This was added in 56dfed7, but never
used.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Nov 21, 2022
1 parent 5937a3f commit b069c86
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions transport/ca/localca/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"os"
"testing"

"github.com/cloudflare/cfssl/config"
"github.com/cloudflare/cfssl/csr"
"github.com/cloudflare/cfssl/helpers"
"github.com/cloudflare/cfssl/initca"
"github.com/cloudflare/cfssl/selfsign"
)

func tempName() (string, error) {
Expand All @@ -25,53 +23,6 @@ func tempName() (string, error) {
return name, nil
}

func testGenerateKeypair(req *csr.CertificateRequest) (keyFile, certFile string, err error) {
fail := func(err error) (string, string, error) {
if keyFile != "" {
os.Remove(keyFile)
}
if certFile != "" {
os.Remove(certFile)
}
return "", "", err
}

keyFile, err = tempName()
if err != nil {
return fail(err)
}

certFile, err = tempName()
if err != nil {
return fail(err)
}

csrPEM, keyPEM, err := csr.ParseRequest(req)
if err != nil {
return fail(err)
}

if err = ioutil.WriteFile(keyFile, keyPEM, 0644); err != nil {
return fail(err)
}

priv, err := helpers.ParsePrivateKeyPEM(keyPEM)
if err != nil {
return fail(err)
}

cert, err := selfsign.Sign(priv, csrPEM, config.DefaultConfig())
if err != nil {
return fail(err)
}

if err = ioutil.WriteFile(certFile, cert, 0644); err != nil {
return fail(err)
}

return
}

func TestEncodePEM(t *testing.T) {
p := &pem.Block{
Type: "CERTIFICATE REQUEST",
Expand Down

0 comments on commit b069c86

Please sign in to comment.