×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Smile j2me https connection ( midp2.0 ) , netbeans keystore import to emulator

    I am developing a midlet to get some data back from a servlet running on my tomcat. I want to use https to get the data back.These are the steps I followed. My tools are
    1.netbeans 4.5 , sun WTK emulator , tomcat 6.0 .
    What and I did so far ,

    1. I uncomment server.xml in tomcat to enable 8443 port .

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS" />

    2. I deleted .keystore file in my home directory and created a new keystore file using the below command.

    keytool -genkey -alias tomcat -keyalg RSA

    I gave CN name as 127.0.0.1

    3.I accessed my servlet using the URL from firefox https://127.0.0.1:8443/secureapp

    It told me about a certificate issue and I gave security confirmation and the ceritificate
    was downloaded to browser and I got servlet output in browser window.

    4.Now I want to connect to servlet using j2me.So I used the below code to get the certificate details.
    I am using Netbeans and using emulator provided by SUN,WTK Version 2.5.2.

    try {
    // Query the server and retrieve the response.
    HttpsConnection hc = (HttpsConnection)Connector.open("https://127.0.0.1:8443/secureapp");
    SecurityInfo si = hc.getSecurityInfo();
    Certificate c = si.getServerCertificate();
    String subject = c.getSubject();

    String s = "Server certificate subject: \n" + subject;
    Alert a = new Alert("Result", s, null, null);
    a.setTimeout(Alert.FOREVER);
    mDisplay.setCurrent(a, form);
    hc.close();
    }
    catch (Exception ioe) {
    Alert a = new Alert("Exception", ioe.toString(), null, null);
    a.setTimeout(Alert.FOREVER);
    System.out.println(ioe.toString());
    mDisplay.setCurrent(a, form);
    }

    Problem : I could not connect to my servlet.And I get the exception as

    javax.microedition.pki.CertificateException: Certificate was issued by an unrecognized entity

    I only know that I need to import my certificate to my emulator or something.I googled a lot and could not come to a solution.I tried to import my new keystore and export key to emulator.It simply says error occured while exporting keys.

    I need someone to help me import the certificate to my emulator so that I can connect to my servlet by https.I would like an answer from someone who has really done this scenario and successfully used self signed certificate in an emulator.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Does this or that help?

Similar Threads

  1. How Can I import tomcat public key into S60 3rd Edition Emulator
    By anniesingh in forum Mobile Java General
    Replies: 2
    Last Post: 2010-03-14, 20:50
  2. S60_3rd_FP1_SDK Emulator + NetBeans problem
    By Bugdog in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2009-11-05, 05:31
  3. Netbeans & emulator problem
    By iceland in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2009-08-09, 15:00
  4. Series 60 J2ME emulator problems
    By evertomi in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2009-06-15, 10:21
  5. Error in buliding a j2me project
    By siyamudheen in forum Bluetooth Technology
    Replies: 3
    Last Post: 2009-05-11, 06:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •