Reading Data From an Item
Of course, once you have fetched the item, you can do all sorts of nifty things with it. For example, if you wanted to read the password, the account name, the description, and the modification date from an item, you would create an attribute list containing those attributes and call SecKeychainItemCopyContent():
OSStatus SecKeychainItemCopyContent (SecKeychainItemRef itemRef,
SecItemClass *itemClass,
SecKeychainAttributeList *attrList,
UInt32 *length,
void **outData);
Note that here the attrList is specifying what data you want and is also acting as a receptacle. Add these functions to dumpem.m:
// Given a carbon-style four character code, make a C string ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.