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.
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?
精彩评论