Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How do you save passwords?

How do you save passwords?
Thread Tools
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jun 23, 2002, 02:47 PM
 
Has anyone had to do it before? If so, how do you encrypt the passwords in a PLIST? Thanks
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jun 23, 2002, 03:55 PM
 
why not use the <a href="http://developer.apple.com/techpubs/macosx/Carbon/securityservices/keychainmanager/Keychain_Manager/index.html" target="_blank">keychain manager</a>?

i've only used it to retrieve passwords, but storing them shouldn't be too hard, either...
     
Bwa
Dedicated MacNNer
Join Date: Oct 2000
Location: Somerville, MA and San Jose, CA
Status: Offline
Reply With Quote
Jun 27, 2002, 10:44 AM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Synotic:
<strong>Has anyone had to do it before? If so, how do you encrypt the passwords in a PLIST? Thanks </strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">I usually use the UNIX crypt function. It's a one way algorithm and uses salt. Check `man 3 crypt'
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jun 29, 2002, 07:48 AM
 
Yeah, you'll want to hash them. You can use crypt(), but that only uses the first 8 characters, I think. libcrypto (part of OpenSSL and installed as standard on OS X) might have RC4 and MD5, otherwise I'm sure you can find a freeware library that does them somewhere.
     
Senior User
Join Date: Mar 2001
Location: Bay Area, CA
Status: Offline
Reply With Quote
Oct 30, 2002, 11:54 AM
 
Originally posted by Angus_D:
Yeah, you'll want to hash them. You can use crypt(), but that only uses the first 8 characters, I think. libcrypto (part of OpenSSL and installed as standard on OS X) might have RC4 and MD5, otherwise I'm sure you can find a freeware library that does them somewhere.
Okay, can anybody either give decent instructions on using crypt to store/retrieve passwords (or libcrypto)? Either that, or point to a good tutorial on the web somewhere. I'd also like to do this, and have had trouble finding a decent set of instructions anywhere via google (C specific would be nice, most deal with PHP implementation).

I'd rather do this than keychain, if for no other reason that I think it will be more generally applicable.

Thanks
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Oct 30, 2002, 02:11 PM
 
Here is the man page for libcrypto. You want the 'sha' function to get a hash of a password.

It's pretty self-explanatory.
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Senior User
Join Date: Mar 2001
Location: Bay Area, CA
Status: Offline
Reply With Quote
Oct 31, 2002, 12:31 AM
 
Originally posted by smeger:
Here is the man page for libcrypto. You want the 'sha' function to get a hash of a password.

It's pretty self-explanatory.
Unfortunately, I'm one of those people who doesn't find man pages self-explanatory. I can encrypt and store a password using SHA1, but how the heck do I get it out?

Anybody?
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Oct 31, 2002, 08:35 AM
 
Originally posted by msykes:


Unfortunately, I'm one of those people who doesn't find man pages self-explanatory. I can encrypt and store a password using SHA1, but how the heck do I get it out?

Anybody?
You don't get it out. Ever.

When the user types the password (after it has been stored), you use SHA1 on that password, and compare the encrypted value to the encrypted password you stored earlier. If they match, let the user proceed.
     
Senior User
Join Date: Mar 2001
Location: Bay Area, CA
Status: Offline
Reply With Quote
Oct 31, 2002, 06:39 PM
 
Originally posted by hayesk:


You don't get it out. Ever.

When the user types the password (after it has been stored), you use SHA1 on that password, and compare the encrypted value to the encrypted password you stored earlier. If they match, let the user proceed.
Okay, so I guess that means that using SHA1, or associated functions in order to store default password values is, well, not possible?

I'm trying to store the last password value used in the program, to have it available as default the next time the user launches the app.

To the keychain it is then!
     
eno
Banned
Join Date: Sep 2000
Location: Fightclub
Status: Offline
Reply With Quote
Nov 1, 2002, 04:22 PM
 
Originally posted by msykes:
To the keychain it is then!
You should always use the keychain. Users like it.

And if they move machines, they can just take their keychain file with them instead of thousands of pref files for different apps.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:28 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2