Move certificate verification code to VerifyConnection

This commit is contained in:
adnano
2020-10-13 16:44:46 -04:00
parent db89a34935
commit 3d1e9e5519
7 changed files with 18 additions and 60 deletions
+1 -3
View File
@@ -7,7 +7,6 @@ import (
"crypto/x509"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strconv"
@@ -93,7 +92,6 @@ func (k *KnownHosts) Lookup(hostname string, cert *x509.Certificate) error {
// Certificate is expired
continue
}
log.Print(k.hosts[i].Expires, now)
if k.hosts[i].Fingerprint == fingerprint {
// Fingerprint matches
return nil
@@ -101,7 +99,7 @@ func (k *KnownHosts) Lookup(hostname string, cert *x509.Certificate) error {
// Fingerprint does not match
return ErrCertificateNotTrusted
}
return ErrUnknownCertificate
return ErrCertificateUnknown
}
// Parse parses the provided reader and adds the parsed known hosts to the list.