-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The cosmetic difference is that generic passwords now have a label and GenericPassword.__repr__ will use it. This involved adding or fixing several struct definitions, multiple constants and dealing with several misleading parts of the Keychain documentation. The next step will be to move this into the classes and expand the support beyond labels to allow any keychain attribute to be retrieved or, finally, updated. --HG-- extra : convert_revision : d12eed8
- Loading branch information
Showing
4 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
# encoding: utf-8 | ||
import ctypes | ||
import PyMacAdmin | ||
import struct | ||
|
||
# This is not particularly elegant but to avoid everything having to load the | ||
# Security framework we use a single copy hanging of this module so everything | ||
# else can simply use Security.lib.SecKeychainFoo(…) | ||
lib = PyMacAdmin.load_carbon_framework('/System/Library/Frameworks/Security.framework/Versions/Current/Security') | ||
|
||
# TODO: Expand this considerably? | ||
# TODO: Expand this considerably or find a better way to deal with pre-defined constants | ||
CSSM_DB_RECORDTYPE_APP_DEFINED_START = 0x80000000 | ||
CSSM_DL_DB_RECORD_X509_CERTIFICATE = CSSM_DB_RECORDTYPE_APP_DEFINED_START + 0x1000 | ||
kSecCertificateItemClass = CSSM_DL_DB_RECORD_X509_CERTIFICATE | ||
|
||
# typedef FourCharCode SecItemClass; | ||
# SecKeychainItem.h | ||
# TODO: Expand these constants to avoid calling struct.unpack() | ||
kSecInternetPasswordItemClass = struct.unpack('BBBB', 'inet') | ||
kSecGenericPasswordItemClass = struct.unpack('BBBB', 'genp') | ||
kSecAppleSharePasswordItemClass = struct.unpack('BBBB', 'ashp') | ||
kSecCertificateItemClass = CSSM_DL_DB_RECORD_X509_CERTIFICATE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters