jdk7 调用 https url 握手_失败

问题描述

jdk1.7.0_79 和 okhttp 3.8 调用 https url 失败

import (
  "os"
  "golang.org/x/sys/unix"
)

func main() {
  // do stuff with piped input

  pid := os.Getpid()
  pgid,err := unix.Getpgid(pid)

  if err != nil {
    log.Fatalf("could not get process group id for pid: %v\n",pid)
  }

  processGroup,err := os.FindProcess(pgid)

  if err != nil {
    log.Fatalf("could not find process for pid: %v\n",pgid)
  }

  processGroup.Signal(os.Interrupt)
}

写入和读取TLSv1为什么还是handshake_failure,如果使用jdk8就可以了,握手信息如下

syscall

客户端和服务器都使用 TLSv1.2

因此尝试将 jdk7 默认 tls 更改为 TLSv1.2 在此 doc 中遵循以下方法

main,WRITE: TLSv1 Handshake,length = 148
main,READ: TLSv1 Alert,length = 2
main,RECV TLSv1 ALERT:  fatal,handshake_failure
main,called closeSocket()
main,handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
main,called close()
main,called closeInternal(true)

但这次仍然是handshake_failure 调试信息是

main,WRITE: TLSv1.2 Handshake,length = 170
main,READ: TLSv1.2 Handshake,length = 93
main,length = 5516

这次 write 使用 TLSv1.2 但 recv 仍然使用 TLSv1。 为什么会这样?如何让客户端和服务器都使用 TLSV1.2?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)