Modifying Emacs to use the Mac OS X Keychain Services
From:
Ben Key
Subject:
Modifying Emacs to use the Mac OS X Keychain Services
Date:
Tue, 31 May 2011 21:04:00 -0500
Hello,
I am still working on this task. I did not finish it by Today as I expected.
So far I am working on the ns-keychain-create-item function and the ns-keychain-get-secret function. I will add more functions as I go on.
For those who are wondering, here are some details on how I am implementing these functions.
The ns-keychain-create-item function has the same parameters as secrets-create-item (collection, item, password, and &rest attributes). It essentially just calls the Keychain Services API functions SecKeychainAddGenericPassword to create the password and SecKeychainItemModifyAttributesAndData to process the attributes. When I call SecKeychainAddGenericPassword I map the collection parameter to the serviceName parameter, the item parameter to the accountName, and the password parameter to the passwordData parameter.
The ns-keychain-get-secret function has the same parameters as secrets-get-secret (collection and item) and it essentially just calls SecKeychainFindGenericPassword and returns the retrieved passwordData parameter. Again, when calling SecKeychainFindGenericPassword I map the collection parameter to the serviceName parameter and the item parameter to the accountName parameter.
Since I can only work on this project on nights and weekends, it may take me several weeks to complete this task. As Daniel Colascione and Ted Zlatanov recommended I am making the Keychain file the passwords used by Emacs a configurable option that defaults to the default Keychain file.
Once I am finished with this task, I will post a patch to this list so that the community can review it before I check it in. It is my hope that this patch will be ready in 3 weeks.