Question

I am looking for initial ideas for protecting user downloaded content. Users download zip files full of interesting resources that get extracted into their local file system to be used by the application.My goal is to prevent the user to share the downloaded resources to other users via the internet (let's assume they gain access to the files by whatever means). Something that could be used in an iOS application and possibly platform independent.

Thank you

Was it helpful?

Solution

The first step is to put the files in a protected (by apple) location and make sure that location is not backed up in iTunes by the user:

//Get the Library path (not visible to user
NSString *path = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]

//Tell apple not to back it up in iTunes
+(void)addSkipBackupAttributeToPath:(NSString*)path {
    u_int8_t b = 1;
    setxattr([path fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
}

Now this doesn't help with jailbreaking and other, more devious, things users can do to gain access to these locations. The next thing would be to encrypt the files individually and dynamically decrypt them when they are going to be used. This is the most processor intensive way, but quite a bit more secure. For encrypting and decrypting I would suggest the RNCryptor library. That is a lot more involved and will take quite a bit of research on your part, sorry it's too much to be written in a general question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top