Load client cert with LoadX509KeyPair

This commit is contained in:
Ken-Håvard Lieng 2020-05-18 00:36:15 +02:00
parent 0c902f8ac8
commit 2d68f04ab2

View File

@ -42,17 +42,7 @@ func (u *User) SetCertificate(certPEM, keyPEM []byte) error {
} }
func (u *User) loadCertificate() error { func (u *User) loadCertificate() error {
certPEM, err := ioutil.ReadFile(Path.Certificate(u.Username)) cert, err := tls.LoadX509KeyPair(Path.Certificate(u.Username), Path.Key(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)
if err != nil { if err != nil {
return err return err
} }