Expand description
Reading and writing macOS .keychain database files directly.
This is the CDSA-era keychain format — the one security create-keychain
still writes on macOS 26 — parsed and produced without the Security
framework, so it works on any host and needs no entitlements.
formatis thekychcontainer: tables, records, attribute values.schemais the self-describing schema every keychain carries.cryptois the encryption the container specification omits.dbties them together: open, unlock, query, decrypt.querydefines typed, composable predicates shared withkc get.writecreates keychains and adds items.editupdates, deletes, re-seals and re-authorizes what is already there.
See README.md for the format notes and the security caveats.
Re-exports§
pub use access::AccessDecision;pub use access::AccessDefault;pub use access::AccessMode;pub use access::AccessPolicy;pub use acl::AclBlob;pub use acl::ApplicationAccess;pub use acl::TrustedApplication;pub use db::Info;pub use db::Item;pub use db::ItemRef;pub use db::KeychainFile;pub use db::Query;pub use der::decode_private_key;pub use edit::ItemChanges;pub use edit::Settings;pub use edit::StoredIdentity;pub use error::Error;pub use error::Result;pub use format::Keychain;pub use format::Record;pub use format::Value;pub use locator::KeychainLocator;pub use locator::SYSTEM_KEYCHAIN;pub use pkcs12::Identity as Pkcs12Identity;pub use pkcs12::decode as decode_pkcs12;pub use pkcs12::decode_identity;pub use pkcs12::encode as encode_pkcs12;pub use pkcs12::is_combined_pem;pub use query::Comparison;pub use query::Expression;pub use query::MatchOptions;pub use query::Predicate;pub use schema::AttributeFormat;pub use schema::RecordType;pub use schema::Schema;pub use write::CreateOptions;pub use write::NewIdentity;pub use write::NewItem;pub use write::create;pub use write::now_timestamp;
Modules§
- access
- Keychain-wide access policy primitives.
- acl
- Public ACL blobs, parsed and produced as structures.
- apple_
schema - Apple’s keychain schema, as data.
- crypto
- Keychain cryptography: master key derivation, the database blob, wrapped item keys, and item secrets.
- cssm
- CSSM structures that appear inside keychain blobs, as types.
- db
- Opening, unlocking, and querying a keychain database.
- der
- Just enough DER to fill in a certificate record’s attributes.
- edit
- Changing a keychain that already exists: updating items, deleting them, rewriting an item’s access control, and re-sealing the database itself.
- error
- Errors for keychain parsing, crypto, and item lookup.
- format
- The
kychcontainer: file header, tables, records, attribute values. - index
- Table indexes: the sorted lookup structures in the trailing part of a table.
- locator
- Resolve human-friendly keychain names to database paths.
- output
- Shared text/JSON rendering helpers for callers (including the
kcCLI): the two shapes its output takes. - pkcs12
- Decode an identity from a PKCS#12/PFX container.
- query
- Typed item predicates shared by the library and
kc get. - records
- Typed records: the attribute sets stored for an item and for its key.
- requirement
- Reading an application’s designated requirement out of its code signature.
- schema
- Relations and attributes — the schema a keychain carries about itself.
- secret
- Secret bytes and the randomness that produces them.
- write
- Creating keychains and adding items.