XOR or other simple file obfuscation method ios objective c

I am working on an ios application that uses copyrighted pdf files. I am looking for some simple ways to obfuscate the files for security that won’t require me to go through the additional Mass Market CCATS encryption review process but will also ensure the copyright holders I’ve done my bit to keep their data safa. I password protect the files of course, but I want to bring it a step or two further. Is there a simple method to XOR or otherwise hash or obfuscate a pdf file I’ll be hosting on my server, then have the ios device download it and restore it to a regular password protected pdf file using objective-c code so it can save it in the documents directory (I’m not worried about its security on the device as much as when it’s sitting on the server). I assume that this would be the same for any filetype.

So for clarification I’m looking for a simple XOR or Hash obfuscation/encryption method on my desktop that has corresponding objective c code the ios device can use to quickly decode my files after download and save it to the documents directory.

  • How does one change the color for text highlighting in Xcode 4 for warnings and errors?
  • XCode 4.2 SVN issues
  • What are best practices to decrease the size of static libraries in objective-c?
  • iOS 7: Cannot connect to IBOutlets, probably because I'm using UITableViewController
  • Xcode free provisioning: The 'Apple Push Notification' feature is only available to users enrolled in Apple Developer Program
  • Create video with AVVideoCompositionCoreAnimationTool and AVAssetExportSession SLOW
  • Thanks so much!

    here is an answer about CCATS limitations for reference …
    Need to apply for CCATS if using simple XOR cipher?

    Solutions Collect From Internet About “XOR or other simple file obfuscation method ios objective c”

    However you’re downloading the file, you’re probably ending up with an NSData? If so, wherever you probably have something like this:

    [myData writeToFile:...]
    

    Just dash through all the bytes and apply your XOR. Supposing it were a dense 8-bit pattern, that’d just be:

    /* assuming myData is mutable... take [data mutableCopy] if required */
    uint8_t *bytes = (uint8_t *)[myData mutableBytes];
    
    for(int index = 0; index < [myData length]; index++)
        bytes[index] ^= 0xe8; // or whatever your mask is
    

    Which suggests the most trivial way to apply a longer pattern:

    uint8_t *bytes = (uint8_t *)[myData mutableBytes];
    uint8_t pattern[] = {0xe8, 0xf4, 0x98, 0x32, 0x63}; // or whatever
    const int patternLengthInBytes = 5;
    
    for(int index = 0; index < [myData length]; index++)
        bytes[index] ^= pattern[index % patternLengthInBytes];
    

    It’d be slightly faster to proceed in 32-bit steps, but the saving to disk is probably going to be the only thing that has any significant sort of cost and that’s at least very clear.