views:

315

answers:

7

I want to be able to deliver music/mp3 using a flash player but I'd like to make it so that the mp3 files cannot be sniffed... i.e. you can't use safari, firebug..etc. to find out the mp3 location using the activity window. I don't have a streaming server. Any idea?

If I go with a streaming server, any suggestions on how to go about it (cheaply)?

+3  A: 

This is more or less impossible. Since the client can connect, it must know the address. You're looking to obscure the source, but you can't hide it completely, and I suppose the easiest way would be to use some kind of browser plugin, flash and java comes to mind (as you've suggested), which asks a server for the address. Note that it's still very much possible to analyze the flash or java program, as the browser still needs to download the .swf file.

A different approach would be to use a single-use URL, where server serves up a URL which can only be used once. It's still 'sniffable' and can still be exploited if it's intercepted before the client connects though.

roe
Not only is it possible to analyze the program, but there are programs for monitoring HTTP traffic that can even more easily catch requests and replies.
Chris Charabaruk
@Chris; of course, that's why I always say 'address', which might not be a URL. How you access the data doesn't matter, it's still possible to analyze the program and get access that way.
roe
I'm using the earlier suggestion but it's still sniff-able. I think your later suggestion would work - one-time URLs. Would you know any PHP packages that does that?
JONYC
@JONYC: 'one time URLs' are the same thing as the access keys PartlyCloudy mentioned. It's not really hard, just send a random number to the client, store it in the php-session, and when the request arrives, check if it's the same (perhaps transformed in some non-trivial way to obscure it) and remove it as valid from the session.
roe
+3  A: 

If you're delivering an mp3 to the user's computer, you're delivering an mp3 to the user's computer. I guess you can try encryption of some sort to make it harder to recover the MP3, but if the user's computer can play it, it can also take those same bits and save them off to disk before playing them.

Yuliy
+6  A: 

You really cannot distinguish safely clients in HTTP. When they record the whole traffic, they always can replay the interaction, unless you use some cryptographic mechanisms.

As an easy approach, I would try to allow requests only in combination with an access key. The access key is created by yourself and send to the browser as a parameter of the URI. When the clients sends the request, it is only valid if the provided access key is valid as well. Within the access key, you could encode some information like IP address, time range, user agent etc.

But as I said, there is no 100% secure way to protect your data, as long as you eventually expose it via HTTP. There is always the hardcore approach to sniff your whole traffic and rebuild the files that way.

Access keys are used by Amazon S3, but there are also plugins for webservers like nginx.

PartlyCloudy
Do you know of any access key packages in PHP?
JONYC
+1  A: 

It's not really possible to conceal the URL without using some sort of closed technology like Flash. An alternative you can use is to keep your MP3s in a password-protected directory but stream them to the browser via a server-side script that bypasses that protection. That way, even if someone knows the URL of an MP3 file, they can't download it by simply entering its address in their web browser.

Jimmy Cuadra
Even using Flash won't help, given a sufficiently intelligent end user. Flash applets can be decompiled and analyzed, and programs like Fiddler let users see all HTTP traffic between their machine and others.
Chris Charabaruk
+1 to Chris. Either you use HTTP, and Fiddler will catch it, or you use something else and deal with all the problems - like users whose firewalls block your non-standard protocol.
MSalters
+2  A: 

Go for streaming, or it's impossible. Firebug, Opera's Dragonfly, etc. show all HTTP requests run by the browser, there is no way to hide them. I download media from "within" flash regulary (YouTube, for example), and it works every time, except with streaming, because that's not HTTP.

GodsBoss
I like your honesty. :)
JONYC
I used to download streaming all the time when mlb.com's flash player didn't work on linux. Just grabbed the one-time keys using a javascript breakpoint and fed them to my media player.
roe
+1  A: 

You can use a 2-way encryption.

You pass encrypted URLs to the audio player then have the player reverse-encrypt them. Not 100% secure but it could help.

Emanuil
I tried that... It didn't work because people can sniff the HTTP address using things like Tampa, Safari Activity window...etc.
JONYC
the thing is, when the audio player decrypts the url, it makes a request to the server, and then the client knows what that url is.
matt lohkamp
Sure, it's not a 100% secure approach.
Emanuil
could try encrypting the audio/video stream itself? then if the user finds the url the data can't be played back without the correct key.
Shrill
+1  A: 

use a socket server and obscure the connection. I think something like electroserver should do what you want, it used to have a free license up to 25 or so users, then its only a couple hundred to license it. Not sure about ES4.... It might be overkill for your needs.