XOR or another simple method for obfuscating ios Object files c

I am working on an ios application that uses copyright protected PDFs. I am looking for some simple ways to obfuscate files for security, which will not require me to go through the additional CCATS analysis of the mass market, but will also provide the copyright holders that I did to save their data. Of course, I protect file passwords, but I want to take one more step. Is there a simple method for XOR or else hash or obfuscation of the PDF file that I will post on my server, after which the ios device will download it and restore it to a regular password-protected file using objective-c code so that it can save this in the directory documents (I don’t worry about its security on the device the same as when it sits on the server). I assume this will be the same for any type of file.

So, for clarification. I am looking for a simple XOR or Hash obfuscation / encryption method on my desktop that has the corresponding c object code that the ios device can use to quickly decode my files after downloading and saving it in the document directory.

Many thanks!

here is the answer about CCATS limitations for reference ... Do I need to use CCATS when using a simple XOR cipher?

+3
source share
1 answer

However, you are uploading a file, probably you will end up in NSData? If so, wherever you probably have something like this:

[myData writeToFile:...]

Just skip all the bytes and apply XOR. Suppose it was a dense 8-bit pattern that would only 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

:

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];

32- , , , , , , .

+6

All Articles