Switch language
zh
Switch theme
Light
  • Fix Failed to Verify Certificate X509

    修复 “Failed to Verify Certificate X509” 问题 问题出现背景 linux 环境下在 go 中用一个函数获取 https 证书有效期, 在查询一个由 freessl cname 申请的证书后, 发现报错 Errortls: failed to verify certificate: x509: certificate signed by unknown authority 而在 windows 环境又正常, 遂在 linux 中使用 curl https://xxx.com 得到 curl: (60) Peer's Certificate issuer is not recognized. More details here: http://curl.haxx.se/docs/sslcerts.html package pkg import ( "crypto/tls" "errors" "time" ) func WillExpireIn7Days(hostname string) (bool, time.Time, error) { conn, err := tls.Dial("tcp", hostname+":443", nil) if err !
🍀