From 2d68f04ab2d865b2233c40ad778a8a8db7fe50e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ken-H=C3=A5vard=20Lieng?= Date: Mon, 18 May 2020 00:36:15 +0200 Subject: [PATCH] Load client cert with LoadX509KeyPair --- storage/user_cert.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/storage/user_cert.go b/storage/user_cert.go index c7be127d..037b52dc 100644 --- a/storage/user_cert.go +++ b/storage/user_cert.go @@ -42,17 +42,7 @@ func (u *User) SetCertificate(certPEM, keyPEM []byte) error { } func (u *User) loadCertificate() error { - certPEM, err := ioutil.ReadFile(Path.Certificate(u.Username)) - if err != nil { - return err - } - - keyPEM, err := ioutil.ReadFile(Path.Key(u.Username)) - if err != nil { - return err - } - - cert, err := tls.X509KeyPair(certPEM, keyPEM) + cert, err := tls.LoadX509KeyPair(Path.Certificate(u.Username), Path.Key(u.Username)) if err != nil { return err }