Need to develop J2ME midlet mp3 player which plays encrypted mp3 by decrypting it on the fly

Need to develop J2ME midlet mp3 player which plays encrypted mp3 by decrypting it on the fly.

Means the midlet shouldnot physically decrypt the encrypted mp3 file and then play. Instead it should load block by block into the memory and play on the fly smoothly.

This will help in keeping the encrypted mp3 unchanged and safe without the danger of decrypting and leaving the file accidentally.

I need help regarding this in J2ME, as it seems difficult to find way to decrypt on the fly and play without editing/changing the encrypted mp3 file.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I have used Bouncy Castle ciphers in web apps and they are worth the price you pay.  I have also written many J2ME applications and if I was going to do what you are looking to do I would look to Bouncy Castle first, second and likely last.  Ciphers in genral are dificult to code and need to be implemented correctly in order to insure they are truely secure.
RajeshPixelAuthor Commented:
Dear Crossdev

Thank you cery much for your valuable response.

But this is what our programmers saying:
"converting a file on the fly and play is not possible because in J2ME custom Piped datasources are not possible (write from one end and read from other).

Another solution may be to write multiple slices of the mp3 files in fliesystem and use multiple players to play them one after the other but even in this case there is a 1/4th of a second delay before next player can start playing and we have no control over that as well."

Can you relate this to your solution or suggest something regarding the above to make things more clear for both of us.

Thanks in advance.

HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Crteate a Socket connection from the phone and read the data.  essentially creae the connection that you need.  I don't see the concern other that what they need doesn't exist.  It can be written.  
RajeshPixelAuthor Commented:
Dear Crossdev

J2ME Player can be initialized using Manager.createPlayer which takes an InputStream or ByteArrayInputStream (Not interested in datasouce constructor). According to the specs Manager would load the complete input stream before the player instance will play the audio file.

Secondly CipherInputStream from BouncyCastle is not available for J2ME version. So it means one have to read from the input stream and decrypt the file into a byte array then that decrypted byte array can be fed in to the Manager.createPlayer to create the player instance.

Other solution may be to write a custom FilterredInputStream and decrypt the data byte by byte and feed that stream to Manager.createPlayer.

In any case stream has to be read fully before we can play the file using player instance just created by the Manager.

So is there any solution I can do this i.e. Decrypt the input stream from the mp3 file and play the decoded stream right away so that player doesn't have to wait for all the file to be decrypted first and then play it.

Thanks in advance
It must be the plementation of the player.  I do not kow of any players out there.  I do know that a stream cipher is meant to do encryption / decription on small chuns of data rather all at once.  

Bouncy Castle lib can be used on J2ME provided there is space.  I have seen it on a Blackberry curve 8330.  I don't recall which of their libraries it was, or if there was anything special that needed to be done.

Hi.. Now i'm trying to do the same work. decrypting and playing mp3 file >8mb in j2me player.

Mr.RajeshPixel , please tell me y u dont want to store use DataSource. What is the problem in using that.?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.