Secure way to unlock full version via In-App Purchase

后端 未结 4 1470
情话喂你
情话喂你 2021-01-01 00:04

I\'m planning to use In-App Purchases to unlock some features in my app. What is the most secure way to do this?

Originally I planned to set a Bool in the NSUs

相关标签:
4条回答
  • 2021-01-01 00:37

    I came across some problem and found two common ways for secure storing of In-App Purchases:

    1) Using secure version of NSUserDefaults:

    a) "Secure NSUserDefaults". This version of NSUserDefaults generate hash for any saved secret item and provide to you validation of this hash for item after. So, you can easily deal this situation of "hack" defaults .plist by user.

    Check here: https://github.com/matthiasplappert/Secure-NSUserDefaults

    b) "SecureNSUserDefaults". NSUserDefaults with AES encryption. My advise here not just storing secure bool values for purchases, but rather some obfuscated string for indication of payment done or not.

    Check here: https://github.com/nielsmouthaan/SecureNSUserDefaults

    2) Using KeyChain

    a) "RSSecrets" Simple class to store key-value items in KeyChain. See also discussion here: Storing In App Purchase receipts in the application Keychain

    And check project: https://github.com/jeffargast/RSSecrets

    b) "STKeychain" Mostly this class used for storing login/pass in KeyChain, but in project of MKStroreKit (popular In-App Purchases StoreKit for iOS devices) they actually use this class for storing In-App Purchases.

    Check here: https://github.com/ldandersen/STUtils/blob/master/Security/STKeychain.h

    P.S. I am not yet used any of this classes in my project, but think to use "RSSecrets"

    0 讨论(0)
  • 2021-01-01 00:43

    Yes, it's relatively easy to modify application preferences. But does it really matter? I would wager that anybody who is willing to crack open their iPhone filesystem and modify config files to save a quid or two is not the type of person who would be inclined to spend the money if they were unable to do so.

    0 讨论(0)
  • 2021-01-01 00:58

    Security through Obfuscation is the simplest way to go here (e.g. don't name your var "isPro" and perhaps don't have it's value be a simple BOOL but instead have it be some "magic" integer. Not foolproof but another speed bump to cracking.

    As an alternative to using NSUserDefaults you could save a file to the app filesystem and then check it's contents at app launch.

    Not sure it is worth the time and trouble though.

    0 讨论(0)
  • 2021-01-01 01:00

    You could save it in the keychain, but then on a jailbroken device it's also easy to read and change that. So you should encrypt the data. Make sure that the encryption password can not be found easily in your app by scanning the binary.

    0 讨论(0)
提交回复
热议问题