Hi
Is this possible that to create your custom certificate & sign your Mobile Application ?so the answer is yes it is possible but how?this is also a another question that annoying me too much .so after goggling too much & try different procedure i don't get success but than i try to learn where i do mistake because if you are using symbian os handset it so easy but if you are using Windows mobile 6.0 & want to run the J2me application on it with custom certificate Signing so it makes many problem.
Now i here tell u the a steps of creating the custom certificate , how to sign & run the application successfully on the Handset(mine is Windows Mobile 6.0).
Tools we needed is Carbide.j & Openssl.
Now let start Creating the Custom Certificate for our Appliciation .
Step 1
First create your .jad & .jar files you want to sign .Also add the permission of the restricted Api that your application used.
Step2
Now open the command prompt set the Path to openssl Directory(mine is C:/openssl/bin/)
run the following commands
genrsa -des3 -out ca.key 4096
it wil create the ca.key that's your fake self-signed CA private key .
req -new -x509 -days 365 -key ca.key -outform DER -out ca.cer
this command create ca.crt file that's your CA’s public key (certificate) in PEM format
req -new -x509 -days 365 -key ca.key -out ca.crt
this command will create ca.cer file that's your CA’s public key (certificate) in DER format
Note:When you run these above commands it will ask the some valid questions so answer them.
Now, test the certificate's validity by installing it on your desktop. If you are on windows, just double click it and windows will say if the cert is invalid.
Step #3
Now we generate the Certificate signing request(CSR).For CSR i used Carbide.j tool open the Carbid.j (strandalone) Select "Create Application Package" view. In "General" tab choose "recreate based on existing package" option. Pick path to your JAD and JAR files. Now change to "Sign Application Package" view. If you have something in "available alias" area, you may delete at the first time. Click "New keypair" and enter your (your company's) information and click "Create".
Now you should create new entry in the alias box. Click on "Generate CSR". It will prompt to enter a file name (say code-sign.csr). Enter a valid file name in a known location and click OK. Now you have a Certificate Signing Request (CSR) that you can submit to a CA.!
so the file code-sing.csr created.
Step# 4
Now we create the code signing certificate that's the important step.so run these on command prompt.
Note:run this OpenSSL command under (make sure all key/crt/csr files are accessible).
x509 -req -days 365 -in code-sign.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out code-sign.crt
The file created is code-sign.crt.
Step #5
Now we create the certificate package .In this step we combine the ca.crt & code-sign.crt to create .p7c file .I used Internet explorer certificate manager.
Open IE.
Go to Tools->Internet Options->Contents->Certificates.
Pick trusted Root Certificates tab and click import.
Click "Next" & choose path to ca.crt and click "Finish"
Now click on the "Intermediate Certificate Authorities" tab & click Import select code-sign.crt & click Finish .Once it successfully imported you will see the certificate among the other certificate in the "Intermediate Certificate Authorities"tab .
Now select your certificate in the "Intermediate Certificate Authorities"tab and click export pick the file format PKCS#7 (.P7B). and check “include all certificates in the certification path if possible” check box.
Continue until it say Successfully imported & you see code-sign.p7b has been created.
Step #6
Now its time to sign the Midlet .Open the Carbide.j tool .Click on the "Sign Application Package" .Click import certificate & pick the file we created in above step.
Now click the "Sign" and pick your Jad file i hope you will see the Success Message Box.
Step #7
Now verify your .jad you should see the lines like on your jad.
MIDlet-Certificate-1-1: M234gaf...
MIDlet-Certificate-1-2: MLLP343...
MIDlet-Jar-RSA-SHA1: UIYW993...
Step # 7
Now install the certificate into your Windows Mobile6
Connect the mobile to computer through usb .Place your ca.cer file & your sign .jad & .jar file in the mobile directory.
Disconnect the mobile to computer browse the ca.cer in the mobile directory & select the ca.cer file.Then install the certificate & if the certificate successfully installed it prompt that "One or more certificated Installed".
After Installing the certificate open your jvm you used (I used javafx jvm for windows mobile) int the jvm certificates option you see your certificate .
Now close the jvm & browse the directory where you install your .jad & .jar file .Install the Application during install it will show that the application s signed .
After installation don't run the application first set the permissions on your applications .(I used only read & write data api so i select it "Allow Always"the options different across the jvm ) .
No its time to run the installed Application.
I Hope your Application will run & Good Luck :).
Tuesday, October 26, 2010
Thursday, July 8, 2010
How to achieve the MVC Pattern in j2me Mobile Application
Hi
how can we achieve the MVC pattern in Mobile Application so how can we do it .we can use the MVC pattern in mobile application when we have working on large project that have more than 10 screens .There are ways to how create the screen
1) Create the separate MIdlet for each screen .
2) Create the single Midlet & define all the function that create the screens & perform its task in the single Midlet & display.setCurrent call each method when they want to show the particular screen .
this technique is good & work well faster than option 1 but there is some problem with this approach .Let we discuss
*)My code become too complex that hard to manage .
*)If the requirement change so its hard to me to change it .
*)It hard to manage the Objects .
so What's now we should implement the MVC pattern in this project .how?
Let see this.
The scenario is we have Single Midlet that have the Display Object to show the screen on the Midlet.For make the Midlet to act ascontroller it should be singleton but we cannot do it because the constructor of the Midlet always be public.
so what we do
We create the static function that return the static controller Object .In the constructor we call the super() method & set the staticControllerObject=this;
Now that's make our controller to act as singleton singleton
we have a classes each screen has its own class in which they all inherit with interface that have the hashtable with its getter & setter & that interface implement another interface that have the function that return Displayable Object .
so all the classes that extend the first interface should implement the function that return Displayable Object so all the classes should implement it .
If we want send data between screen we use get & set hashtable method to send & receive data from the screen.
Now back to our controller
All the classes want to show will call the controller function to get the controller object then by using this object we call the function that get the class name & hashtable Object. Get the Object of the class by using the for.ClassName (that we discuss in previous post) after getting the class object we call the set method of hashtable & pass the hashtable to the argument then call the function that return the Displayable Object so that the controller should show that object.
Now what we achieve
*)Our all screens were separate all the screens were manage there commands & if they to go to next screen they just call the controller method by passing the screen Class name & hashtable to send the data to next screen then Rover will transfer it to the next screen.
*)Our Code will easy to manage & we would remove the dependency of screen to the other .
*)The Controller Midlet will only act as a controller it not listening any command

That's all hope its work for you But its work god for me :)
how can we achieve the MVC pattern in Mobile Application so how can we do it .we can use the MVC pattern in mobile application when we have working on large project that have more than 10 screens .There are ways to how create the screen
1) Create the separate MIdlet for each screen .
2) Create the single Midlet & define all the function that create the screens & perform its task in the single Midlet & display.setCurrent call each method when they want to show the particular screen .
this technique is good & work well faster than option 1 but there is some problem with this approach .Let we discuss
*)My code become too complex that hard to manage .
*)If the requirement change so its hard to me to change it .
*)It hard to manage the Objects .
so What's now we should implement the MVC pattern in this project .how?
Let see this.
The scenario is we have Single Midlet that have the Display Object to show the screen on the Midlet.For make the Midlet to act ascontroller it should be singleton but we cannot do it because the constructor of the Midlet always be public.
so what we do
We create the static function that return the static controller Object .In the constructor we call the super() method & set the staticControllerObject=this;
Now that's make our controller to act as singleton singleton
we have a classes each screen has its own class in which they all inherit with interface that have the hashtable with its getter & setter & that interface implement another interface that have the function that return Displayable Object .
so all the classes that extend the first interface should implement the function that return Displayable Object so all the classes should implement it .
If we want send data between screen we use get & set hashtable method to send & receive data from the screen.
Now back to our controller
All the classes want to show will call the controller function to get the controller object then by using this object we call the function that get the class name & hashtable Object. Get the Object of the class by using the for.ClassName (that we discuss in previous post) after getting the class object we call the set method of hashtable & pass the hashtable to the argument then call the function that return the Displayable Object so that the controller should show that object.
Now what we achieve
*)Our all screens were separate all the screens were manage there commands & if they to go to next screen they just call the controller method by passing the screen Class name & hashtable to send the data to next screen then Rover will transfer it to the next screen.
*)Our Code will easy to manage & we would remove the dependency of screen to the other .
*)The Controller Midlet will only act as a controller it not listening any command
That's all hope its work for you But its work god for me :)
Achieve the Reflection in j2me
Hi
We can not use the Reflection in j2me as we use in j2se because it unavailable in j2me.So how can we achieve it i could workaround & found some Solution
First
add the class name in the build .xml to unobfuscate the class name if we cant so class.forName could not recognize the class name .
jsut add the
then make the interface(FormNameInterfacae) & take the full class name as String(class1) & use that string to get the instance of the class
then take interface (dispalyInfo) that contain the Hashtable that contain its getter & setter
class1 extend the displayInfo interface to share the data between the screens by using the hashtable get & set method
then take another inteface(DisplayInterfacae) that have the function(getObject) that return Displayable Object & it also extend the (displayInfo) interface
Now use should implement the getObject method of (DisplayInterface) in class1 that return displayable object .
Now cast that class instance to that inteface Object Like that
DisplayInterfacae displayInterface=(DisplayInterfacae)class.forName(FormNameInterfacae.class1);
& display the form as calling getObject Method like that
Display display=Display.getDisplay(this);
display.setCurrent(displayInterface.getObject());
It will show the class1 getdisplay method & show the displayble Object you return in class1.
We can not use the Reflection in j2me as we use in j2se because it unavailable in j2me.So how can we achieve it i could workaround & found some Solution
First
add the class name in the build .xml to unobfuscate the class name if we cant so class.forName could not recognize the class name .
jsut add the
then make the interface(FormNameInterfacae) & take the full class name as String(class1) & use that string to get the instance of the class
then take interface (dispalyInfo) that contain the Hashtable that contain its getter & setter
class1 extend the displayInfo interface to share the data between the screens by using the hashtable get & set method
then take another inteface(DisplayInterfacae) that have the function(getObject) that return Displayable Object & it also extend the (displayInfo) interface
Now use should implement the getObject method of (DisplayInterface) in class1 that return displayable object .
Now cast that class instance to that inteface Object Like that
DisplayInterfacae displayInterface=(DisplayInterfacae)class.forName(FormNameInterfacae.class1);
& display the form as calling getObject Method like that
Display display=Display.getDisplay(this);
display.setCurrent(displayInterface.getObject());
It will show the class1 getdisplay method & show the displayble Object you return in class1.
Friday, June 18, 2010
Saturday, May 22, 2010
Working on J2me databases (SERME)
Last week i spent most of time to search the best j2me database to store y large data that give me the sql query functionality i found many of these but they all are paid .So i change my focused & try to search the databases that are save the RMS .I already know aboutthe j2me RMS so isearch the any third party wrapper that provide me functionality so i found the SERME .
SerME is very simple serialization and persistence library. It is intended to be used at J2ME (MIDP 1.0 and MIDP 2.0) which is not providing reflection and serialization capabilities. SerMe is able to store data using two APIs: first - RMS (javax.miroedition.rms) is standard for J2ME an dincluded in MIDP 1.0, second - using files, which are supported by javax.miroedition.io.file package which is optional package for MIDP 2.0 implemented mostly on smartphones and PDA devices.
So i used SERME & save the data on RMS with the help of SERME i am able to store the HASHTABLE into the RMS & if i want to retrieve data from RMS it will return the Hashtable So it gives lots of advantages according to my needs .
If i just want to store the Data on RMS by using SERME here is the Code:
ISSUES
The issues i face for using SERME is that it will not provide any tutorial & not found any stuff in internet to how to use it there is only some examples int the serme website that will give me some help so that' s why i share this read data & write data code .
There is a issue with serme that when we write the Class Object in HashTable in & save it in RMS using SERME .But next time when i read the HashTable from the RMS & get the object from HashTable it will give the
The problem is that when j2me application run it obfuscate the class name so when we try read our database so it will threw an exception .So the solution is that
keep class="com.packagename.abcclass"
ADD the following Line in the build.xml tag
So what;s this line do on runtime it will not obfuscate the classname on comipletime.
SerME is very simple serialization and persistence library. It is intended to be used at J2ME (MIDP 1.0 and MIDP 2.0) which is not providing reflection and serialization capabilities. SerMe is able to store data using two APIs: first - RMS (javax.miroedition.rms) is standard for J2ME an dincluded in MIDP 1.0, second - using files, which are supported by javax.miroedition.io.file package which is optional package for MIDP 2.0 implemented mostly on smartphones and PDA devices.
So i used SERME & save the data on RMS with the help of SERME i am able to store the HASHTABLE into the RMS & if i want to retrieve data from RMS it will return the Hashtable So it gives lots of advantages according to my needs .
If i just want to store the Data on RMS by using SERME here is the Code:
RmsStorage storage=new RmsStorage("Customer");//Customer is the file that create on RMSIf i want to retrieve my Data from RMS usning SERME here is the code:
storage.create();//Here we create the File
HashTable dump=new HashTable();
dump.add(new Integer(1),customerclassobject);
storage.setRoot(dump);//Set the root object of the database
storage.close();//close the database
RmsStorage storage=new RmsStorage("Customer");//Customer is the file that create on RMS
storage.create();//Here we create the File
HashTable dump=new HashTable();
dump=storage.getRoot();//Get the Root object from the Storage
storage.close();//close the database
ISSUES
The issues i face for using SERME is that it will not provide any tutorial & not found any stuff in internet to how to use it there is only some examples int the serme website that will give me some help so that' s why i share this read data & write data code .
There is a issue with serme that when we write the Class Object in HashTable in & save it in RMS using SERME .But next time when i read the HashTable from the RMS & get the object from HashTable it will give the
Error :"abcclass not found"*abcclass is the class that's object i store on the hashtable.
The problem is that when j2me application run it obfuscate the class name so when we try read our database so it will threw an exception .So the solution is that
keep class="com.packagename.abcclass"
ADD the following Line in the build.xml
Subscribe to:
Posts (Atom)