问题标签 [httpsurlconnection]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ssl - 获取java.net.SocketException:软件导致连接中止:sslSocket.startHandshake()期间recv失败;
我在客户端遇到异常,即使当我尝试使用 httpsurlconnection 访问 url 时,我在客户端设置了密钥库的所有属性,如协议、keystoretyoe、密码所有内容。
但如果我 trustAll,setNeedClientAuth(false),那么它工作正常。
javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接
我的前卫可能有什么问题?感谢您提供任何帮助
Thx
GK
json - 使用 HttpsURLConnection 和 OutputStreamWriter 发布 JSON 失败
我正在使用 Processing 2.0.2 并导入 java 的java.net
、javax.net
和java.io
类。
我正在尝试将 JSONObject 发送到“ https://www.bitstamp.net/api/balance/ ”。
JSONObject 包含登录信息。我用这个函数创建它:
我成功设置了连接,然后将连接传递给此函数以发送请求。
我收到响应代码 200 并返回“OK”消息。Bitstamp 返回一个 JSON 对象,内容如下:
"error": "缺少用户和/或密码 POST 参数"}
我很困惑为什么 Bitstamp 没有接收或接受我的 JSONObject。我已经阅读了关于 JSON 和 POSTing 的大约六篇关于 SO 的帖子,但我似乎无法理解。
java - 从 Java 中的 https-URL 读取
目前我正在尝试编写一个程序,它会返回一个列表,其中包含 booklooker.de 上书籍列表中最低价格的列表。该网站本身使用https,我想这就是问题所在。
代码:
并返回错误:
我不知道到底出了什么问题,但 HttpsURLConnection 似乎有问题。有人有想法吗?
android - Webview 无法在 android 中加载 https url?
我正在android中实现webview应用程序。当我尝试加载https url一到两次时,它会完成活动。Agian 试图加载https url它显示网页不可用。请在下面找到我得到的图片。
当我再次单击该网址时,它会显示该网站。
我使用下面的代码来加载 url。
请任何帮助家伙.......
提前致谢
java - 使用 HTTPS 连接重定向响应
创建了一个新的 HTTPS 连接并在连接 URL 上执行了一个 GET 方法调用。
我没有发送 301 (30X) 重定向,而是收到了带有 XHTML 页面数据的响应,当在浏览器中处理时,它会自动提交并发送到重定向页面,但是如何在 java 代码中处理同样的问题?
这是响应数据
仅供参考:我只需要向表单操作属性中的 URL 发送 HTTP/HTTPS 请求。我不打算在浏览器中打开 html。
java - weblogic.net.http.SOAPHttpsURLConnection 无法转换为 javax.net.ssl.HttpsURLConnection
我在尝试使用 javax.net.ssl.HttpsURLConnection 连接到 url 时收到“java.lang.ClassCastException”。
我正在使用 Weblogic Server 10.3.4。
我得到的例外是:
出现此错误的任何可能原因?
android - SSL TrustManager setup on lower Android APIs
I have an app communicating with a HTTPS RPC.
The HTTP server is using a CAcert signed certificate.
I'm using a custom TrustManager for validating the certificate.
- Because I can not be sure, CAcert is included in all devices' trusted key store.
- Because I want to allow only CAcert to sign a certificate for this connection.
However, I'm following Google's best practices. The only thing I changed is:
- Load the CAcert root certificate from a static byte[] instead a file
- Replace the last part, where the example code loads a file, with
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
. There is a JSONRPC2 API on top of the UrlConnection.
Devices tested:
- working on Nexus 4 / mako running API18 / CM10.2
- working on API18 emulator
- working on API17 emulator
- working on API14 emulator
- not working on a HTC G2 running API10 / CM7.*
- not working on API8 emulator
On low API devices it fails verifying the certificate during SSL handshake.
When trying to load https://google.com
with this TrustManager
on API18, it fails as expected because no trust anchor could be found.
So basically, this code should work and all of the methods are API1...
I know, that UrlConnection was broken on some lower APIs.
How do I fix this?
Code:
Logs:
java - java.net.ProtocolException: 服务器重定向太多次 (20)
我有这个代码:
结果是:
请求 URL ... " http://www.web1.com " 响应代码 ... 302 Redireccionando ... Galletas: 07c18a1bea3520c44535aafeeea31dec07a36313; path=/ 重定向到 URL:“ https://www.web2.com ” java.net.ProtocolException: 服务器在 sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java 重定向太多次 (20) :1635) 在 sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) 在 Demo2.main(Demo2.java:58)
问题是什么?我要疯了
android - HttpsUrlConnection:在 2.3 上找不到证书路径的信任锚
那里。我需要与https://free.temafon.ru建立 https 连接,但我在 Android 2.3 及更低版本上遇到了 CertPathValidatorException。我做了什么。
- 使用 Firefox从https://free.temafon.ru获取所有证书。
- 从 temefon 证书到根证书依次导入 keystore 中的证书。
初始化 ssl 上下文:
最终 KeyStore 密钥库 = KeyStore.getInstance("BKS");
在这里,我使用自定义 TrustManager,因为服务器以错误的顺序发送证书。
此代码在 Android 4.0 上运行良好,但在 2.3 上因 java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
我做错了什么而失败?
我创建了一个测试项目,可以在这里找到。
android - Android自签名证书:找不到证书路径的信任锚
我知道这个主题在很多地方都被讨论过,但是在我经历了几乎所有这些之后,我决定创建我的第一个 StackOverflow 问题......
问题如下:
我想连接到使用证书来限制访问的安全 Web 服务 (https),并使用用户名/密码对用户进行身份验证。所以我有一个客户端证书(p12 文件)和一个服务器证书(pem 或 der 文件)。我尝试使用 HttpURLConnection 类,因为据我所知,Android 将不再支持 Apache 库。
所以这是我的实现(serverCert 和 clientCert 是我的文件的完整路径):
所以我可以创建我的 SSLContext,并显示我的两个证书内容。但是当我尝试执行 HTTPS 连接时,出现以下异常:
09-23 13:43:30.283: W/System.err(19422): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: 找不到证书路径的信任锚。
你们中有人遇到过以下错误吗?你的解决方案是什么?
这些是我浏览的网站(没有成功):
http://blog.chariotsolutions.com/2013/01/https-with-client-certificates-on.html
http://nelenkov.blogspot.ch/2011/12/using-custom-certificate-trust-store-on.html