Expand description
Creating keychains and adding items.
Three operations, all of which have to agree with macOS byte for byte to be useful:
createwrites a new database: the four schema tables replayed fromapple_schema, an empty table per record relation, and a metadata record holding a freshDbBlobsealed with the caller’s password.KeychainFile::add_passwordstores an item: a wrapped item key in the symmetric-key table and the encrypted secret in the item record.KeychainFile::add_identitystores a certificate and its private key, adding the certificate relation to the schema first if the keychain has never held one.
Every write rebuilds the indexes of the tables it touched, because their
offsets are table-relative: a stale index region sends macOS into the middle
of a record and it reports errSecNoSuchAttr.
Structs§
- Create
Options - Settings for a new keychain. The defaults are what macOS writes.
- NewIdentity
- An identity to store: a certificate and the private key that matches it.
- NewItem
- What to store for a new password item.
Functions§
- create
- Build a new keychain protected by
password. - expected_
format - Formats used by the password relations, for tests and diagnostics.
- format_
timestamp - Format a timestamp the way keychain date attributes are written.
- now_
timestamp - Timestamp for right now.
- schema_
of_ created - Verify a schema built by
createagainst the file’s own declarations.