How to encrypt mp3 files in iOS

I have an application that downloads MP3 files from our web server and instantly saves them in an NSData object. This object is then written to the .mp3 file stored in the / Library / Cache folder in the application sandbox.

When it's time to play the file, I upload it to AVPlayerItem, for example:

NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp3", trackID]]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath]; self.trackPlayerItem = [[AVPlayerItem alloc] initWithURL:fileURL]; 

I think that start downloading this item in AVPlayer and play it.

So, my main question is: how can I encrypt these mp3 files while they are stored on the disk, to make sure that they can not be simply plucked from the file system by anyone who has a Jailbroken device?

I already watched Stack Overflow, but could not find anything that helped.

Hope someone can help me. Thanks

0
source share
1 answer

Check out this thread about adding RSA encryption / decryption to NSData .

+2
source

All Articles