adrianderbaum
adrianderbaum

Reputation: 133

How to secure a Mac Application with a password?

i am currently trying to secure my Objective-c application with a password. What I want is a window(or similiar..) popping up whenever the application is launched. Only if the password is right shall the user be able to use the program. How to encrypt the string properly? I don't want any user to be able to extract it from the content files. Even though the user should be able to change it once he "logged in".

Thanks in advance. I am asking for a hint only :)

Upvotes: 0

Views: 325

Answers (2)

v1Axvw
v1Axvw

Reputation: 3054

You can create an md5-hash of the password and store that in a file. If someone else opens this file and sees the hash, it almost impossible to reformat it back to the original password. Now when the user enters a password in your application, make an other md5 hash from that one, and compare if that hash is the same as you stored in the file.

man 3 md5 for creating md5 hashes on Mac with C code. I don't know any Objective-C wrapper for that, but it should be easy to create it yourself.

Hope it helps, ief2

EDIT: Keychain Services is indeed the more "standard" solution

Upvotes: 0

user557219
user557219

Reputation:

Whenever you want to store sensitive information such as passwords, use Keychain Services.

Upvotes: 3

Related Questions