Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
lassewidda
Posts: 3
Registered: ‎10-27-2009
My Device: Not Specified
Accepted Solution

Providing a signed COD from jad/jar for OTA downloads

[ Edited ]

 

 

I have a j2me application consisting of a jad and a jar file. I want to create a .cod file, sign it and put it on a web server for ota downloads.

 

I have created the .cod like this (blackberry jde 4.7.0):

 

rapc.exe -import=net_rim_api.jar codename=appname -midlet -jad=appname.jad appname.jar

This creates a .cod file ok.

 

The problem now is that the jad file is not updated with the rim specific jad properties.

 

I have used the http://www.jatfq.com/archives/20 to extract the properties from the cod file

 

java -jar cod2jad.jar appname.cod appname

 

This outputs the properties that should be added to the jad file:

 

RIM-COD-URL: appname.cod
RIM-COD-Size: 77128
RIM-COD-SHA1: 5d ca c0 97 59 27 1d 7b fb de f7 b8 9f 32 48 e1 12 43 a2 b9
RIM-COD-URL-1: appname-1.cod
RIM-COD-Size-1: 59748
RIM-COD-SHA1-1: 0d df 87 09 70 c0 82 1f f3 bd 13 90 a2 0d e9 d5 e4 82 94 17
RIM-COD-URL-2: appname-2.cod
RIM-COD-Size-2: 49424
RIM-COD-SHA1-2: b9 7a 82 c9 67 1e 91 94 f5 89 94 a1 1c ba 6d 25 ce ad cb 8d
RIM-COD-Module-Name:appname
RIM-COD-Module-Dependencies: net_rim_cldc
RIM-COD-Creation-Time: 1202924527


I have uploaded this jad file to my web server, set the mime types for jad and cod and unpacked the cod file to be able to provide the appname.cod, appname-1.cod and appname-2.cod for download.

 

This works fine and the blackberry (8900 and 9000 models) are able to download, install and run ok.

 

Now to the problem. If I sign the cod file, its not possible to extract the child cod files from the main cod to provide them for  download.

 


unzip appname.cod
Archive: appname.cod
file #1: bad zipfile offset (lseek): 557056
file #2: bad zipfile offset (lseek): 630784
file #3: bad zipfile offset (lseek): 696320

 

 

Is it possible to provide signed applications OTA that consist of more than one child cod file?

 

How do I first sign and then unpack?

 

 

 

 

 

 

 

 

 

 

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Providing a signed COD from jad/jar for OTA downloads

You need to sign the COD file that is actually a ZIP archive. The Signature Tool will unpack it, sign the individual modules, and then repack. I've never seen it not work. You then need to unpack the signed COD and reference the unpacked files in your JAD file, same as you did for the unsigned COD.

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Providing a signed COD from jad/jar for OTA downloads

If signing the composite COD still doesn't work, you can always sign the unpacked modules individually.

Please use plain text.
New Developer
lassewidda
Posts: 3
Registered: ‎10-27-2009
My Device: Not Specified

Re: Providing a signed COD from jad/jar for OTA downloads

Yes, what I did was to sign the original cod file that rapc.exe created from the jar file. It is not the actual signing process that fails.

 

The only way i've managed to install a cod from a jad file OTA is to unpack the cod zip and provide it's contained cod files on the web server.

 

Without the cod2jad.jar helper application, i'm not able to create a jad file that contains the rim specific attributes (RIM-COD-SHA1 and so on)

 

1. create cod file

2. sign cod file

3. create a jad file that holds all the rim specifics? <-- This is the main step where I fail

 

 

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Providing a signed COD from jad/jar for OTA downloads

I thought you said you couldn't generate a signed COD that would work...

 

There isn't much mandatory information that you need to provide in the JAD. For example, SHA-1 hashes are optional. It's pretty trivial to generate a JAD file.

Please use plain text.
New Developer
lassewidda
Posts: 3
Registered: ‎10-27-2009
My Device: Not Specified

Re: Providing a signed COD from jad/jar for OTA downloads

Actually, I have gotten it working now when unpacking the cod first and signing the child cod's file by file. Thanks

Please use plain text.