security-rs 0.5.0

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
10
11
12
#[path = "support/mod.rs"]
mod support;

use security::{Certificate, Cms};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let certificate = Certificate::from_der(&support::fixture("test-cert.der"))?;
    let encoded = Cms::encode_supporting_certificates(&[certificate])?;
    let decoded = Cms::decode_all_certificates(&encoded)?;
    println!("cms_len={} certs={}", encoded.len(), decoded.len());
    Ok(())
}