security-rs 0.2.1

Safe Rust bindings for Apple's Security framework — keychain, identity, certificates, trust, authorization, CMS, SecureTransport, and cryptographic primitives on macOS
Documentation
1
2
3
4
5
6
7
8
9
use security::SecureRandom;

#[test]
fn generates_random_bytes() -> security::Result<()> {
    let bytes = SecureRandom::bytes(32)?;
    assert_eq!(bytes.len(), 32);
    assert!(bytes.iter().any(|byte| *byte != 0));
    Ok(())
}