tls: oversized record received with length XXXXX

2019-04-13 10:26发布

I use the built-in standard SSL socket client library (net + crypto/tls) like this:

conn, err := net.Dial("tcp", "exploit.im:5222")
//...
config := tls.Config{InsecureSkipVerify: true}
tls_conn := tls.Client(conn, &config)
fmt.Println(tls_conn.Handshake())

And am getting the message:

conn, err := net.Dial("tcp", "exploit.im:5222")

I managed to find out it is somehow related to the default maximum packet size (16384 + 2048 set in common.go:31). Is there any standard work around (without patching this value & rebuilding the lib)?

标签: ssl go starttls
1条回答
家丑人穷心不美
2楼-- · 2019-04-13 10:53

You get this kind of messages if you try to do a SSL handshake with a peer which does not reply with SSL. In this case it is probably some XMPP server and with XMPP you first have some clear text handshake before you start with SSL. Trying to start directly with SSL will result in interpreting the servers clear text response as an SSL frame which can result in strange error messages like this.

查看更多
登录 后发表回答