Skip to content

Instantly share code, notes, and snippets.

@ghaskins
Created September 4, 2015 20:01
Show Gist options
  • Save ghaskins/5f9758d7e8cb48bf1f7d to your computer and use it in GitHub Desktop.
Save ghaskins/5f9758d7e8cb48bf1f7d to your computer and use it in GitHub Desktop.
var conn *tls.Conn
if conn, err = tls.Dial("tcp", "10.20.30.215:2000", config); err != nil {
panic("failed to connect: " + err.Error())
}
defer conn.Close()
certs := conn.ConnectionState().PeerCertificates
if len(certs) != 1 {
log.Panicf("Connected with too many (%d) certificates presented\n", len(certs))
}
cert := certs[0]
if err = cert.CheckSignature(cert.SignatureAlgorithm, cert.RawTBSCertificate, cert.Signature); err != nil {
log.Panicln(err)
}
fmt.Println("Connected")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment