Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto/tls: remote error: handshake failure #8608

gopherbot opened this issue Aug 28, 2014 · 2 comments

crypto/tls: remote error: handshake failure #8608

gopherbot opened this issue Aug 28, 2014 · 2 comments


Copy link

@gopherbot gopherbot commented Aug 28, 2014

by webluoye:

What does 'go version' print?

go version go1.3.1 linux/amd64

What steps reproduce the problem?

remote error: handshake failure
use tls package connect to not success
error mmessage:remote error: handshake failure
when using GO 1.2  can connect successfully.
golang code:

        cert, err := tls.LoadX509KeyPair("", "")
        if err != nil {
                log.Fatalf("server: loadkeys: %s", err)
        config := tls.Config{
                Certificates: []tls.Certificate{cert},
                ClientAuth:         tls.VerifyClientCertIfGiven,
                InsecureSkipVerify: true}
        ladd, lerr := net.ResolveTCPAddr("tcp", "")
        if lerr != nil {
                log.Fatalf("local addr: %s", lerr)
        radd, rerr := net.ResolveTCPAddr("tcp", "")
        if rerr != nil {
                log.Fatalf("server addr: %s", rerr)
        ipConn, err := net.DialTCP("tcp", ladd, radd)
        conn := tls.Client(ipConn, &config)
        if err != nil {
                log.Fatalf("client DialTCP: %s", err)
        defer conn.Close()
        hsErr := conn.Handshake()
        if hsErr != nil {
                fmt.Printf("Client connected to: %v\n", conn.RemoteAddr())
                fmt.Printf("%s", hsErr)
        } else {
                fmt.Printf("Client connected to: %v\n", conn.RemoteAddr())
                fmt.Printf("Cert Checks OK\n")

2014/08/28 15:07:15 client: connected to:
Client connected to:
remote error: handshake failure
use NODEJS is ok
var tls = require('tls');
var fs = require('fs');

var options = {
        rejectUnauthorized: false,
        port: 700,
        host: '',
        key: fs.readFileSync(''),
        cert: fs.readFileSync('')

var cleartextStream = tls.connect(options, function() {
                console.log('client connected',
                        cleartextStream.authorized ? 'authorized' : 'unauthorized');
cleartextStream.on('data', function(data) {
cleartextStream.on('end', function() {
client connected authorized
�g<?xml version='1.0' encoding='UTF-8'?>
<epp xmlns='urn:ietf:params:xml:ns:epp-1.0'
epp-1.0.xsd'><greeting><svID>Redwood EPP
@gopherbot gopherbot added the new label Aug 28, 2014

This comment has been minimized.

Copy link

@wheelcomplex wheelcomplex commented Dec 9, 2014

in my case, this is case by remote server does not support tls version renegotiation.

try follow config, hope this can help you:

config := tls.Config{
InsecureSkipVerify: true,
MinVersion: tls.VersionTLS10,
MaxVersion: tls.VersionTLS10,
transport := &http.Transport{
TLSClientConfig: &config,


@bradfitz bradfitz removed the new label Dec 18, 2014
@mikioh mikioh changed the title tls: remote error: handshake failure crypto/tls: remote error: handshake failure Jan 13, 2015
@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015

This comment has been minimized.

Copy link

@rsc rsc commented Jul 14, 2015

Sounds like a dup of #5742.

@rsc rsc closed this Jul 14, 2015
@golang golang locked and limited conversation to collaborators Jul 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.