1

我已经创建了自签名证书并配置了 tomcat 以使用它(端口 443)

当我尝试通过 j2me 应用程序访问它时,我得到 CertificateException

  public void run() {
    String url = "https://192.168.1.40/test/index.jsf";    
    try {
      HttpsConnection hc = (HttpsConnection)Connector.open(url);      
      int respCode= hc.getResponseCode();
    }catch (IOException ioe) {
      Alert a = new Alert(ioe.toString(), null, AlertType.INFO);
    }

javax.microedition.pki.CertificateException:证书验证失败

我认为模拟器可以选择导入证书,但是有没有办法将证书与 j2me jar 打包并使其接受真实移动设备中的自签名证书。

4

1 回答 1

1

一个迟到的答案:很少有手机有这样的功能(导入根证书),我不记得了,可能是 SE(索尼立信)手机和诺基亚 Symbian(不是所有型号)。大多数手机不支持此功能。

您可以考虑在 J2ME 代码(例如 bouncycastle)中使用 SSL 加密,请参见此处:J2me 中的客户端 ssl?

于 2014-10-07T22:09:38.877 回答