gpt4 book ai didi

java - Android SSL https 发布

转载 作者:太空宇宙 更新时间:2023-11-03 13:31:18 24 4
gpt4 key购买 nike

我在这里看到了很多类似的问题,但找不到解决方案。我有一个 web 服务 PHP 文件托管在 x10 溢价。我从他们那里购买了 SSL 证书,可以在浏览器和 iPhone 应用程序上通过 https 访问我的网页。我在 Android 应用程序上执行相同操作时遇到问题。

我尝试了很多解决方案,但总是收到 SSL 错误。我试过这个教程 http://www.makeurownrules.com/secure-rest-web-service-mobile-application-android.html但我得到了

10-04 07:21:57.081: W/System.err(6804): javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x2a1a11a8: Failure in SSL library, usually a protocol error
10-04 07:21:57.081: W/System.err(6804): error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x471f5756:0x00000000)
10-04 07:21:57.091: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:436)
10-04 07:21:57.123: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init (OpenSSLSocketImpl.java:647)
10-04 07:21:57.123: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:618)
10-04 07:21:57.123: W/System.err(6804): at org.apache.http.impl.io.SocketInputBuffer.<init>(SocketInputBuffer.java:70)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.SocketHttpClientConnection.createSessionInputBuffer(SocketHttpClientConnection.java:83)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnection.createSessionInputBuffer(DefaultClientConnection.java:170)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.SocketHttpClientConnection.bind(SocketHttpClientConnection.java:106)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnection.openCompleted(DefaultClientConnection.java:129)
10-04 07:21:57.131: W/System.err(6804): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:172)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
10-04 07:21:57.141: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-04 07:21:57.151: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-04 07:21:57.151: W/System.err(6804): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-04 07:21:57.201: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity.performUpdate(ParkMeActivity.java:233)
10-04 07:21:57.211: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity.access$8(ParkMeActivity.java:220)
10-04 07:21:57.211: W/System.err(6804): at com.lablabla.parkme.ParkMeActivity$3.onClick(ParkMeActivity.java:215)
10-04 07:21:57.211: W/System.err(6804): at android.view.View.performClick(View.java:4084)
10-04 07:21:57.221: W/System.err(6804): at android.view.View$PerformClick.run(View.java:16966)
10-04 07:21:57.221: W/System.err(6804): at android.os.Handler.handleCallback(Handler.java:615)
10-04 07:21:57.221: W/System.err(6804): at android.os.Handler.dispatchMessage(Handler.java:92)
10-04 07:21:57.241: W/System.err(6804): at android.os.Looper.loop(Looper.java:137)
10-04 07:21:57.241: W/System.err(6804): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-04 07:21:57.251: W/System.err(6804): at java.lang.reflect.Method.invokeNative(Native Method)
10-04 07:21:57.251: W/System.err(6804): at java.lang.reflect.Method.invoke(Method.java:511)
10-04 07:21:57.271: W/System.err(6804): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-04 07:21:57.271: W/System.err(6804): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-04 07:21:57.281: W/System.err(6804): at dalvik.system.NativeStart.main(Native Method)
10-04 07:21:57.291: W/System.err(6804): Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x2a1a11a8: Failure in SSL library, usually a protocol error
10-04 07:21:57.291: W/System.err(6804): error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x471f5756:0x00000000)
10-04 07:21:57.311: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
10-04 07:21:57.311: W/System.err(6804): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:395)

我在这里尝试了关于接受所有证书的其他建议,因为我正在调用我自己的网络服务并信任所有证书。

另一件事,我可以在浏览器和 iPhone 应用程序中通过 HTTP 连接访问我的网络服务。但是当我尝试在 Android 中实现它时,我收到了包含

10-04 07:29:47.662: D/RESULT(6900):  instead of REQUEST_URI, we could show absolute URL via:
10-04 07:29:47.662: D/RESULT(6900): http://HTTP_HOST/REQUEST_URI
10-04 07:29:47.662: D/RESULT(6900): but what if its https:// or other protocol?
10-04 07:29:47.662: D/RESULT(6900):
10-04 07:29:47.662: D/RESULT(6900): SERVER_PORT_SECURE doesn't seem to be used
10-04 07:29:47.662: D/RESULT(6900): SERVER_PORT logic would break if they use alternate ports
10-04 07:29:47.662: D/RESULT(6900): -->
10-04 07:29:47.662: D/RESULT(6900): <h1>404 Not Found</h1>

有什么想法吗?

谢谢!

最佳答案

证书和 Android 存在一个已知问题。阅读此线程:Not trusted certificate using ksoap2-android

有一个在 Android 上使用 HTTPs 的解决方案。

[]秒内托

关于java - Android SSL https 发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12849301/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com