From c7df8c251ebce75f5d09d1cc46649616e911e8f4 Mon Sep 17 00:00:00 2001 From: dpucci Date: Tue, 14 Jun 2022 09:47:07 +0200 Subject: [PATCH] fix(pki): export certificates in the given path --- pki/crt.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pki/crt.go b/pki/crt.go index b9f4ba89..e894bbc0 100644 --- a/pki/crt.go +++ b/pki/crt.go @@ -8,6 +8,7 @@ import ( "math/big" "net" "os" + "path/filepath" "time" ) @@ -82,7 +83,7 @@ func Export(crt *CRT, key *Key, path string) error { return err } - certOut, err := os.Create("crt.pem") + certOut, err := os.Create(filepath.Join(path, "crt.pem")) if err != nil { return err } @@ -95,7 +96,7 @@ func Export(crt *CRT, key *Key, path string) error { return err } - keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + keyOut, err := os.OpenFile(filepath.Join(path, "key.pem"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return err }