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 Contributor
Posts: 6
Registered: ‎08-01-2012
My Device: 9900
My Carrier: HCL

How to decrypt encrypted jpeg.rem image and send to the http server

Hi,

 

I am having issue in sending the encrypted jpeg.rem image to the http server.

Till now i have no idea how to decrypt it(if it is possible) or if there is some way to read the encrypted jpeg.rem image and send to the server.

 

Please find the below code which i have use to send the unencrypted jpeg image to the http server-

 

private int readAndSendFile(String imagePath,String imageName,String Metadata, boolean isFileDelete) throws Exception
	{
		//#debug sample
		System.out.println("Reading file 1");
		OutputStream os = null;
		InputStream is=null;

		//		DataOutputStream os = null;
		//		DataInputStream is=null;
		HttpConnection c = null;
		FileConnection f = null;
		int rc=-1;
		try
		{
			f=(FileConnection)Connector.open(imagePath.trim(),Connector.READ_WRITE);
			is=f.openInputStream();

			byte[] metaData = Metadata.getBytes();

			int metaDataLength = metaData.length;

			String url = ServiceURL+imageName+"~"+metaDataLength;

			if (DeviceInfo.isSimulator()) { 
				url += ";deviceside=true";
			}
			c = (HttpConnection)Connector.open(url);
			c.setRequestMethod(HttpConnection.POST);
			c.setRequestProperty("Content-Length",String.valueOf(f.fileSize()+metaDataLength));
			c.setRequestProperty("Keep-Alive","timeout=36000000, max=36000000");
			c.setRequestProperty("Connection","Keep-Alive");
			c.setRequestProperty("Content-Type","application/octet-stream");
			c.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
			//#debug sample
			System.out.println("URL Request Property Set");

			//Getting the output stream may flush the headers
			os=c.openOutputStream();
			int readBytes = 0;
			//Reading the image in chunks and writing it
			byte[] buf = new byte[1024];
			while ((readBytes = is.read(buf)) != -1) {
				os.write(buf,0,readBytes);	            
			}

			os.write(metaData);	
			os.flush();

			// Getting the response code will open the connection,
			// send the request, and read the HTTP response headers.
			// The headers are stored until requested.
			rc = c.getResponseCode();
		}
		catch(Exception e)
		{
			throw e;
		}
		finally
		{
			if(os!=null)
				os.close();
			if(is!=null)
				is.close();
			if(f!=null)
				f.close();
			if(c!=null)
				c.close();
		}
		return rc;
	}

 

Please suggest me if there is any solution to send the encrypted jpeg.rem image to the http server.

Any help in this regards will be a great favour.

 

Thanks.

Contributor
Posts: 28
Registered: ‎01-27-2012
My Device: 8900
My Carrier: airtel

Re: How to decrypt encrypted jpeg.rem image and send to the http server

Hi..

 

Did you find any solution to this??

I am stuck with the same issue.

Would really appreciate your help..pleaseeee

 

Thanks in advance.

Contributor
Posts: 28
Registered: ‎01-27-2012
My Device: 8900
My Carrier: airtel

Re: How to decrypt encrypted jpeg.rem image and send to the http server

hahaha.. dwimalu its youuuu

New Member
Posts: 1
Registered: ‎05-30-2013
My Device: Blackberry 8520
My Carrier: Orange

Re: How to decrypt encrypted jpeg.rem image and send to the http server

Hi, I am having the same problem. I have a Blackberry 8520. All my images are fine apart from 5 recent ones I took yesterday of my baby, but didnt realize that at the end of the file name it has jpg.rem. I can view them on my phone, but as I connected my phone to my laptop today and copied them onto My Pictures, the pictures didnt show up, and when I clicked on them it said that it couldnt locate the pictures etc. Please someone help me as I REALLY do not want to lose them. I scrolled through previous stories on here similar and someone did say they went to Options > Memory > Encryption Mode - Off. I done this and took a random picture just to test and now thankfully its back to just .jpg but this still hasn't solved the problem with that 5 pictures :smileysad: please someone help!! would be muchly appreciated :Helpsmilie:

New Contributor
Posts: 6
Registered: ‎08-01-2012
My Device: 9900
My Carrier: HCL

Re: How to decrypt encrypted jpeg.rem image and send to the http server

Hi,
Jpeg.rem is the encrypted image of BlackBerry and can be decrypted by blackberry only.
First of all insert a SD Card and in settings make the encryption mode off both for SDCard and device. Now copy the image from the device memory to SDCard. The image will be decrypted by device automatically.
New Contributor
Posts: 6
Registered: ‎08-01-2012
My Device: 9900
My Carrier: HCL

Re: How to decrypt encrypted jpeg.rem image and send to the http server

I would like to give the solution for my problem in sending the jpeg.rem image to the http server.

While reading the image, the image path should be till.jpeg not up to .jpeg. rem. The inputstream cannot read the image if the image path given is jpeg.rem. But when we give the image path .jpeg only by avoiding .rem intentionally, then while reading that image from a blackberry device the image first gets decrypted automatically and then it is successfully read by input stream.
After reading the image we can send the image as the above mentioned code by me.