security-rs
Safe Rust bindings for Apple's Security framework on macOS.
Status: v0.1.0 covers the baseline
Security.frameworksurface most doom-fish crates need first: generic-password keychain access, certificate parsing, trust evaluation, current-process code-signing inspection, and cryptographically secure random bytes.
Quick start
use *;
Highlights
Keychain+KeychainEntrywrappers forSecItemAdd,SecItemCopyMatching,SecItemUpdate, andSecItemDeleteCertificate::from_der,subject_summary,der_data, andpublic_keyPolicy+Trustwrappers forSecTrustCreateWithCertificates,SecTrustSetPolicies, andSecTrustEvaluateWithErrorCode::current().signing_information()for bundle identifier, team identifier, entitlements, status word, and sandbox detectionSecureRandom::fill/SecureRandom::bytesoverSecRandomCopyBytes
Smoke example
Run the end-to-end smoke test with:
It round-trips a unique generic-password keychain item, lists accounts for its service, deletes the item again, and verifies that SecRandomCopyBytes returns non-zero output.
License
Licensed under either of Apache-2.0 or MIT at your option.