简体   繁体   English

无法使用bash下载https证书

[英]Unable to download https certificate with bash

I am using gradle to build an Android project. 我正在使用gradle构建一个Android项目。 When I try to run the build task, I get the following exception: 当我尝试运行构建任务时,出现以下异常:

Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated 原因:javax.net.ssl.SSLPeerUnverifiedException:对等方未通过身份验证

Digging a little bit into it, I discovered that the problem is that I can't authenticate the site because I don't have the certificate in my cacerts file. 仔细研究一下,我发现问题是我无法对站点进行身份验证,因为我的cacerts文件中没有证书。

For some reason, the gradle wrapper can't GET this particular xml file. 由于某种原因,gradle包装器无法获取此特定的xml文件。 However, when I run: 但是,当我运行时:

curl https://jitpack.io/com/github/afollestad/material-dialogs/core/0.8.5.7/core-0.8.5.7.pom

I get a response with the XML content. 我收到有关XML内容的回复。 If I open google chrome, I can also access the content and I can even check out the certificate. 如果我打开google chrome,我也可以访问内容,甚至可以检出证书。

I downloaded the certificate from jitpack.io and added to my cacerts file using this tutorial: 我从jitpack.io下载了证书,并使用本教程将其添加到我的cacerts文件中:

http://nerd-ability.blogspot.com.es/2013/01/tech-how-to-fix-sslpeerunverifiedexcept.html http://nerd-ability.blogspot.com.es/2013/01/tech-how-to-fix-sslpeerunverifiedexcept.html

For some reason, it looks like my JVM is not recognizing it. 由于某种原因,看来我的JVM无法识别它。

For testing purposes, I even used the groovy task described in the tutorial to retrieve the xml, but it didn't work, I get the same error. 出于测试目的,我什至使用了教程中描述的常规任务来检索xml,但是它没有用,我得到了相同的错误。

Can you help me to debug this? 你能帮我调试一下吗?

Thank you. 谢谢。

PS: I checked the expiration date of the certificate it is still valid (I downloaded it today) PS:我检查了证书的有效期限,该证书仍然有效(我今天下载了它)

有点担心您被MITM了,但是如果您不在乎,则可以使用http而不是https下载

$ curl http://jitpack.io/com/github/afollestad/material-dialogs/core/0.8.5.7/core-0.8.5.7.pom

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM