Search code examples
macoskeychainlicense-key

OS X - Secure storage for private app license/verification data using Keychain?


Please note: This question is not about the effectiveness of copy protection, the need for protection, the impact of piracy, or one's political views on digital commerce. Instead, it relates to the technical aspect of storing private license keys or data in a way that hides/protects that data from casual or semi-determined users.

Preface: traditionally, many OS X developers have implemented demo/time-limited/usage-limited/shareware licensing schemes by encrypting private data (e.g. the number of app launches) and storing that data in files with obfuscated names, usually within the Preferences and/or Application Support hierarchies. Obviously, this is less than ideal.

Question: what are the options for storing app-specific licence data on OS X, in such a fashion that the casual or even semi-determined user cannot readily delete or modify that data? Can this job be performed by Keychain?

[edit]

(Online verification is not available. The app does not have Sandboxing enabled. Developer ID code signing is ON. I'm looking for something more sturdy than being able to easily remove the license through Keychain Access or system utils.)

Any other suggestions/strategies are welcome. Thanks.


Solution

  • Admin access is always root access at some level. Find the balance between annoying your users & protecting them from themselves in this case. ( nothing about whether or not to do this)

    You probably would need to include a privileged helper app that does the lifting. This is because Cocoa GUI apps normally run with the effective permissions and user ID of the current logged in user, as is common in unix at the command line.

    A helper with different privileges would need an admin to authorize the first time at least. Then the helper can store the data somewhere and change the permissions and ownership (and run as a different user in unix). Other than lots of obscuring and encryption, this is about what you can do as far as I know.