From a3e965b5a72c0b5aed4dd5045d4e3fa4cfd43748 Mon Sep 17 00:00:00 2001 From: Raf <84349012+RafBishopFox@users.noreply.github.com> Date: Sun, 4 Jun 2023 05:44:26 -0400 Subject: [PATCH] Adding a message on the client side if the provided HTTPS cert / key cannot be loaded --- client/command/jobs/https.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/command/jobs/https.go b/client/command/jobs/https.go index 230f1798a..15155eb77 100644 --- a/client/command/jobs/https.go +++ b/client/command/jobs/https.go @@ -20,6 +20,8 @@ package jobs import ( "context" + "crypto/tls" + "fmt" "io/ioutil" "time" @@ -90,5 +92,9 @@ func getLocalCertificatePair(ctx *grumble.Context) ([]byte, []byte, error) { if err != nil { return nil, nil, err } + + if _, err := tls.X509KeyPair(cert, key); err != nil { + return nil, nil, fmt.Errorf("- could not parse cert or key (encrypted keys are not supported): %s", err.Error()) + } return cert, key, nil }