Mac App Store Receipt Validation Code?

前端 未结 13 1714
广开言路
广开言路 2020-12-07 09:04

Wondering if anyone has a tutorial or working code for the new Mac App Store\'s receipt validation? About the only references I\'ve been able to find so far are Apple\'s st

13条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 09:18

    RVNReceiptValidation is great and it uses CommonCrypto rather than the now deprecated by Apple, openssl. you will have to attach a valid receipt to your project to debug it. Do this by getting a valid receipt from another app bundle and create a build phase in your test environment to add it to your bundle. I suggest the following techniques for obfuscation:

    Encrypt the kRVNBundleID and kRVNBundleVersion and decrypt them when you compare them to the CFBundleIdentifier and CFBundleShortVersionString.

    I create an array of function pointers with random values and change them to valid pointers to the functions in RVNReceiptValuation at run time before executing them using code like this:

    static void testFunction(void);
    
    typedef void (*functionPtr)(void);
    
    functionPtr obfuscationArray[8] = {
        (functionPtr)0xA243F6A8,
        (functionPtr)0x885308D3,
        (functionPtr)0x13198A2E,
        (functionPtr)0x03707344,
        (functionPtr)0xA4093822,
        (functionPtr)0x299F31D0,
        (functionPtr)0x082EFA98,
        (functionPtr)0xEC4E6C89};
    
    int main(int argc, const char * argv[]) {
        functionPtr myFuncPtr;
    
        obfuscationArray[3] = &testFunction;
        myFuncPtr = obfuscationArray[3];
        (myFuncPtr)();
    
        return 0;
    }
    
    static void testFunction(void){
        printf("function executed\n");
    }
    

提交回复
热议问题