Signing BT747 for J2ME

2009-03-30
2013-05-02
  • I find "MIDlet jar signing (a tutorial)" in
    http://www.spindriftpages.net/blog/dave/2006/06/18/midlet-jar-signing-a-tutorial-revised/

    I'm signed BT_J2ME v0.2.22 and it's work on my Nokia N70.

    Get required software
       1. Java SDK (JDK) from Sun
       2. Java Wireless Toolkit (WTK) also from Sun (http://java.sun.com/products/sjwtoolkit/index.jsp)

    Create and import a new (test) certificate
       1. Create new certificate:
        keytool -genkey -alias BT_J2ME -keystore BT_J2ME -storepass onepass -keypass onepass -keyalg RSA -validity 3650
       2. Fill in all the prompts about location/company name etc:
           CN=BT_J2ME,
           OU=MTK GPS Mouse Control,
           O=MTK Based GPS datalogger Management SW,
           L=Paris,
           ST=Paris,
           C=FR
       3. See your new certificate:
        keytool -list -keystore BT_J2ME -storepass onepass
       4. Next you must export the certificate so you can import it to your phone:
        keytool -export -alias BT_J2ME -keystore BT_J2ME -storepass onepass -file BT_J2ME.crt

    Sign the application
       1. Sign the Application using jarsigner:
        jarsigner -keystore BT_J2ME -storepass onepass -signedjar BT_J2ME.jar BT_J2ME_0.2.22.jar BT_J2ME
       2. Now you have a signed jar you need to update the MIDlet-Jar-Size in your JAD
       3. Now add the certificate to the JAD using JadTool.jar from the WTK
        java -jar C:\WTK2.5.2_01\bin\JadTool.jar -addcert -alias BT_J2ME -storepass onepass -keystore BT_J2ME -inputjad BT_J2ME_0.2.22.jad -outputjad BT_J2ME.jad
       4. Now add the signature to the JAD again using JadTool.jar
        java -jar C:\WTK2.5.2_01\bin\JadTool.jar -addjarsig -alias BT_J2ME -jarfile BT_J2ME.jar -storepass onepass -keypass onepass -keystore BT_J2ME -inputjad BT_J2ME.jad -outputjad BT_J2ME.jad

    Installing the Certificate on the phone
       1. Import the certificate into your phone
       2. Once the certificate is installed it needs to be authorised for "Application Installation". I turned on everything but I think "Application Installation" is all you need

    The application is only trusted if it is installed using the JAD, the application will still install from the jar but it won’t be trusted.

     
    • Mario De Weerd
      Mario De Weerd
      2009-03-31

      HI
      What I'll do in one of theupcoming versions is add a signed version to the distribution.

      Personally, when I did some signing operations and used it on my Nokia6120, the certificat was not trusted by the phone and the app did not work.
      There was no way to install the certificate on the phone - only paying certificates work for code signing in my case.

       
      • Nokia 6120: S60 3rd Ed FP1
        Nokia N70: S60 2nd Ed FP3

        Process of installing the certificate (BT_J2ME.crt) on the N70:
        1. Is sent to the terminal through buetooth, IR ...
        2. Installing the certificate (Options -> Open)
        3. Prompted to save the certificate
        4. Warns that the certificate may not be safe
        5. Requests security settings: "Application Installation"

        In 6120 the process is not similar?

         
        • OK, I find this: http://discussion.forum.nokia.com/forum/showthread.php?t=158595

          Install Sef Sign certificate
          This only works on S60 2nd Edition phones. As installing MIDlet signing certificates after manufacturing is not allowed in MIDP spec, this behavior has been corrected for S60 3rd Edition devices.

           
          • Mario De Weerd
            Mario De Weerd
            2009-03-31

            Thanks for tracking that down precisely.