[PD1] Fixed checking certificate NotAfter and NotBefore dates
This commit is contained in:
parent
4ea8315aed
commit
91bc887ba5
4 changed files with 38 additions and 6 deletions
|
@ -32,19 +32,23 @@ func (s *Server[T]) ListenLoop() {
|
|||
for {
|
||||
listenerConn, err := s.listener.Accept()
|
||||
if err != nil {
|
||||
log.Fatalln("Server could not accept connection")
|
||||
log.Println("Server could not accept connection")
|
||||
continue
|
||||
}
|
||||
tlsConn, ok := listenerConn.(*tls.Conn)
|
||||
if !ok {
|
||||
log.Fatalln("Connection is not a TLS connection")
|
||||
log.Println("Connection is not a TLS connection")
|
||||
continue
|
||||
}
|
||||
if err := tlsConn.Handshake(); err != nil {
|
||||
log.Fatalln(err)
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
|
||||
state := tlsConn.ConnectionState()
|
||||
if len(state.PeerCertificates) == 0 {
|
||||
log.Fatalln("Client did not provide a certificate")
|
||||
log.Println("Client did not provide a certificate")
|
||||
continue
|
||||
}
|
||||
conn := NewConnection[T](tlsConn)
|
||||
s.C <- conn
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue