Yashman
Yashman

Reputation: 111

Create password protected file

I want to create a password protected TXT file from my app. I don't mind if it'll be a protected folder with the file in it or some kind of protected archive. My goal is to make a file which can only be viewed by those who know a certain password. How is it done in Cocoa?

Upvotes: 1

Views: 1695

Answers (1)

Joshua Nozzi
Joshua Nozzi

Reputation: 61228

Rather than "password-protect" a text file (easily bypassed if the file system can be read by something that doesn't give a **** about your access control), why not write the text file as encrypted data to disk? Here's one example Q&A for AES encryption and a link to an NSData category that makes it easy to use.

Upvotes: 1

Related Questions