Results 1 to 5 of 5
  1. #1


    Member Since
    Mar 02, 2010
    Posts
    3
    Safari + Keychain
    Hi,

    I need to build an application that will save some internet passwords in Keychain in order to avoid Safari to prompt them when those sites are browsed.

    Do you know how to accomplish it? Adding url in KeyChain is not enough, and I'm not sure how to notify Safari to use an item storage in KeyChain...

    Thanks in advance.

  2. #2

    TattooedMac's Avatar
    Member Since
    May 19, 2009
    Location
    Waiting for a mate . . .
    Posts
    8,430
    Specs:
    21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
    Hey eddietec welcome.
    You shouldnt even have to access keychain ?? I just might not be following your question either

    Say im logging into MF for the 1st time, my username then password then click the remember me box, then everytime i log in, i get logged straight in ......

    Unless im missing something techie then keychain works great just like that

    Cheers
    Dont forget to use the Reputation System if someone has helped you out !!!
    Arguing with a zealot is only slightly easier than tunneling through a mountain with your forehead!!!!!
    MoTM ☆☆☆

  3. #3


    Member Since
    Mar 02, 2010
    Posts
    3
    Hi,

    Issue is that I have almost 100 intranets portals that some clients used (because they are not in Active Directory they are prompt to input user+password), we want to use KeyChain to avoid them to input that information for each site. This application will be in charge to add/upgrade logins/passwords for those sites. Problem is that how to add items in keychain in a way Safari can recognize them?

    Best regards.

  4. #4

    TattooedMac's Avatar
    Member Since
    May 19, 2009
    Location
    Waiting for a mate . . .
    Posts
    8,430
    Specs:
    21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
    Ahh no worries then. Ill admit it is a little over my head lol
    Give it time though, someone should be able to come up with the answer your looking for. Good luck with it

    Cheers
    Dont forget to use the Reputation System if someone has helped you out !!!
    Arguing with a zealot is only slightly easier than tunneling through a mountain with your forehead!!!!!
    MoTM ☆☆☆

  5. #5


    Member Since
    Mar 02, 2010
    Posts
    3
    Hi,

    Here is the answer. Safari sets a property in keychain item that only by code can be set/get. This property is kSecSecurityDomainItemAttr. Following code configures one custom key to make it work with Safari:

    Code:
    - (void) updateSecKeychainItemRef:(SecKeychainItemRef)item
    {    
        SecKeychainAttribute attributes[50];
        SecKeychainAttributeList list;
        OSStatus status;
        
        attributes[0].tag = kSecSecurityDomainItemAttr;
        attributes[0].data = "wwww.portaWithActiveDirectory.com";
        attributes[0].length = strlen("wwww.portaWithActiveDirectory.com");
        list.count = 1;
        
        list.attr = attributes;
        //status = SecKeychainItemModifyContent(item, &list, strlen(PWD), PWD);
        status = SecKeychainItemModifyContent(item, &list, 0, NULL);
        
        if (status == noErr) {
            NSLog(@"\tChanged OK\n");        
        } 
        else {
            NSString *errorMsg = (NSString*) SecCopyErrorMessageString(status, NULL);
            NSLog(@"Error in updateSecKeychainItemRef = %d, %@\n", 
                    (int)status, errorMsg);
        }
    }
    Cheers, Eddie.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Safari Keychain Access
    By Rokurosv in forum OS X - Operating System
    Replies: 2
    Last Post: 10-06-2009, 11:06 PM
  2. Keychain Message When Opening Safari
    By TiltedKilt in forum OS X - Apps and Games
    Replies: 3
    Last Post: 08-26-2007, 04:10 PM
  3. keychain and safari- do they talk?
    By mlecho in forum OS X - Operating System
    Replies: 1
    Last Post: 01-03-2006, 08:31 PM
  4. Safari's keychain password?!
    By marin.mac in forum OS X - Apps and Games
    Replies: 2
    Last Post: 10-20-2005, 10:09 AM
  5. Keychain and Safari
    By gtee in forum OS X - Operating System
    Replies: 1
    Last Post: 07-04-2005, 10:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •