duanluo9369 2014-03-14 13:55 采纳率: 100%
浏览 1591

golang:HTTPS请求产生“ crypto / rsa:验证错误”

I'm having trouble accessing https urls with the net/http package.

Here's a working example of the error:

package main

import (
  "fmt"
  "net/http"
)

func main() {
  _, err := http.Get("https://api.bitfinex.com/v1/book/ltcbtc")
  if err != nil {
    fmt.Println(err)
  }
}

This program yields the error,

Get https://api.bitfinex.com/v1/book/ltcbtc: crypto/rsa: verification error

The docs for net/http clearly state,

Get, Head, Post, and PostForm make HTTP (or HTTPS) requests

but I can't find any documentation on this error.

The source for crypto/rsa only has this to say about the error:

// ErrVerification represents a failure to verify a signature.
// It is deliberately vague to avoid adaptive attacks.
var ErrVerification = errors.New("crypto/rsa: verification error")

So I'm not sure where to go from here. I'm pretty sure it's not their fault because Chrome is happy with their https certificate.

I've also tried using a Client with a tls.Config that has InsecureSkipVerify set to true, but that didn't seem to shut this error up.

  • 写回答

1条回答 默认 最新

  • douji8347 2014-03-14 21:04
    关注

    Go uses the system root SSL certificate under linux and windows.

    Given that the test works fine on my ubuntu 12.04 box with go 1.2, either

    1. You are using a very old version of go
    2. Your system has out of date root certificates

    If you want to update your root certificates, here is a hint for windows. Googling should find you more ideas for other OSes.

    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛