以编程方式从 J2ME 接受自签名证书
我已经创建了自签名证书并配置了 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 一起打包并使其在真实的移动设备中接受自签名证书。
I have created self-signed certificate and configured tomcat to use it (Port 443)
When i try to access it through j2me application i get 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:Certificate failed verification
I think emulator has options to import certificate but
is there any way to package the certificate with the j2me jar and make it to accept self-signed certificate in real mobile device.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
迟来的回答:很少有手机有这样的功能(导入根证书),我不太记得了,可能是SE(索尼爱立信)手机和诺基亚Symbian(不是所有型号)。大多数手机不支持此功能。
您可以考虑在 J2ME 代码(例如 bouncycastle)中使用 SSL 加密,请参阅此处:J2me 中的客户端 ssl?
A late answer: few phones have such feature (import root certs), I do not remember exactly, probably SE (sonyericsson) phones and Nokia Symbian (not all models). Majority of phones does not support this feature.
You may consider using SSL encryption in J2ME code such as bouncycastle, see here: Client side ssl in J2me?