J2ME与自签名密钥的ssl连接

时间:2014-07-13 10:06:10

标签: ssl java-me self-signed

我想创建与https连接的服务器的连接,我想使用自签名的ssl密钥,但是当打开与Connector.open(url)的连接时,会出现以下异常:

  

javax.microedition.pki.CertificateException:证书由无法识别的实体发出

     

com.sun.midp.pki.X509Certificate.verifyChain(),bci = 6     - com.sun.midp.ssl.Handshake.parseChain(),bci = 106     - com.sun.midp.ssl.Handshake.rcvCert(),bci = 92     - com.sun.midp.ssl.Handshake.doHandShake(),bci = 77     - com.sun.midp.ssl.SSLStreamConnection。(),bci = 161     - com.sun.midp.io.j2me.https.Protocol.connect(),bci = 215     - com.sun.midp.io.j2me.http.Protocol.streamConnect(),bci = 164     - com.sun.midp.io.j2me.http.Protocol.startRequest(),bci = 7     - com.sun.midp.io.j2me.http.Protocol.sendRequest(),bci = 33     - com.sun.midp.io.j2me.http.Protocol.sendRequest(),bci = 3     - com.sun.midp.io.j2me.https.Protocol.getSecurityInfo(),bci = 5     - main.MainMidlet.commandAction(MainMidlet.java:66)     - javax.microedition.lcdui.Display $ ChameleonTunnel.callScreenListener(),bci = 39     - com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(),bci = 62     - com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(),bci = 27     - com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(),bci = 48     - com.sun.midp.chameleon.CWindow.keyInput(),bci = 30     - javax.microedition.lcdui.Display $ DisplayEventConsumerImpl.handleKeyEvent(),bci = 43     - com.sun.midp.lcdui.DisplayEventListener.process(),bci = 252     - com.sun.midp.events.EventQueue.run(),bci = 130     - java.lang.Thread.run(),bci = 5

任何机构都可以帮我提供示例代码来解决问题。

1 个答案:

答案 0 :(得分:1)

服务器的自签名证书不受客户端信任。要么让它由CA签名,要么导出到客户端的信任库。