• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Adding internet passwords to the keychain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding internet passwords to the keychain


  • Subject: Adding internet passwords to the keychain
  • From: Steve Palmer <email@hidden>
  • Date: Sat, 9 Jul 2005 12:46:02 -0700

I am using the following code to add an internet password to the keychain:

NSURL * secureUrl = [NSURL URLWithString:url];
const char * cServiceName = [[secureUrl host] cString];
const char * cUsername = [username cString];
const char * cPath = "";
int portNumber = [secureUrl port] ? [[secureUrl port] intValue] : 80;
const char * cPassword = [password cString];
SecKeychainItemRef itemRef;
OSStatus status;


    SecKeychainAddInternetPassword(NULL,
                                   strlen(cServiceName),
                                   cServiceName,
                                   0,
                                   NULL,
                                   strlen(cUsername),
                                   cUsername,
                                   strlen(cPath),
                                   cPath,
                                   portNumber,
                                   kSecProtocolTypeHTTP,
                                   kSecAuthenticationTypeDefault,
                                   strlen(cPassword),
                                   cPassword,
                                   NULL);

Disregarding error handling and duplicates for the moment (this is basically a simplified example), if I use the above code to add a username and password for "http://rpc.bloglines.com/listsubs";, it works correctly and adds an entry as expected. However if I then go to this URL in Safari, I get prompted to enter my credentials again and if I allow it to save those credentials to the keychain, I get a second entry for this URL. As far as I can see, both entries look identical apart from the Name and Comment field which I would have assumed should not have mattered.

So why is Safari not picking up the keychain entry I originally created?

- Steve


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Determining if NSArray/NSDictionary is immutable
  • Next by Date: Re: Documentation frustrations
  • Previous by thread: NSSliderCell don't change my data.
  • Next by thread: failed objc_getClass...
  • Index(es):
    • Date
    • Thread