我正在尝试在 j2me 中获取 httpsConnection(下面我的配置的某些部分<如果需要更多,我可以提供更多)
<j2me.midlet.configuration>CLDC-1.1</j2me.midlet.configuration>
<j2me.midlet.profile>MIDP-2.0</j2me.midlet.profile>
WTK 是 2.5.2_01
HttpsConnection connection = (HttpsConnection)Connector.open("https://myURL/user/login", Connector.READ);`
在 connection.open() 我得到
[WtkRun] javax.microedition.pki.CertificateException: Certificate in a chain was not issued by the next authority in the chain
[WtkRun] at com.sun.midp.ssl.X509Certificate.verifyChain(+115)
[WtkRun] at com.sun.midp.ssl.Handshake.parseChain(+111)
[WtkRun] at com.sun.midp.ssl.Handshake.rcvCert(+114)
[WtkRun] at com.sun.midp.ssl.Handshake.doHandShake(+96)
[WtkRun] at com.sun.midp.ssl.SSLStreamConnection.<init>(+173)
[WtkRun] at com.sun.midp.ssl.SSLStreamConnection.<init>(+12)
[WtkRun] at com.sun.midp.io.j2me.https.Protocol.connect(+214)
[WtkRun] at com.sun.midp.io.j2me.http.Protocol.streamConnect(+57)
[WtkRun] at com.sun.midp.io.j2me.http.Protocol.startRequest(+12)
[WtkRun] at com.sun.midp.io.j2me.http.Protocol.sendRequest(+38)
[WtkRun] at com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
[WtkRun] at com.sun.midp.io.j2me.http.Protocol.openInputStream(+9)
[WtkRun] at nkclause.PostClause.a(+162)
[WtkRun] at nkclause.PostClause.startApp(+473)
[WtkRun] at javax.microedition.midlet.MIDletProxy.startApp(+7)
[WtkRun] at com.sun.midp.midlet.Scheduler.schedule(+270)
[WtkRun] at com.sun.midp.main.Main.runLocalClass(+28)
[WtkRun] at com.sun.midp.main.Main.main(+80)
我已经设法获得证书详细信息,所以它的颁发者是
[WtkRun] C=US;O=Thawte, Inc.;CN=Thawte SSL CA
并且浏览器存储中存在相同的发行者;我可以毫无问题地访问 URL。
我也尝试过一些技巧,比如
connection = (StreamConnection) Connector.open("https://myURL/user/login:443;CertificateErrorHandling=warn;HandshakeCommentary=on", Connector.READ);
但例外仍然相同。
我正在寻求处理此案的方法:1)可能是 WTK 模拟器不知道链中的第二个权限。在浏览器中,我可以直观地检查证书颁发者,但是如何在 wtk 中进行 int 操作?2)有没有办法忽略ssl证书问题?旧的答案说不,但自那时以来可能发生了一些变化?