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
1 changed files with 1 additions and 11 deletions

View File

@ -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
}