Git · dadoum.zone
Repositories
Help
Report an Issue
apple-crates
Code
Commits
Branches
Tags
Search
Tree:
a74924e
Branches
Tags
main
apple-crates
airdrop
examples
check_identity.rs
Refactor and unify a lot of things for another project and implement airdrop support
Dadoum
commited
a74924e
at 2026-10-25 22:15:58
check_identity.rs
Blame
History
Raw
//! Check an AirDrop identity directory the way a Contacts Only receiver would: //! `cargo run -p airdrop --example check_identity -- ~/.omdrop/keys`. //! Prints only non-secret facts: no hashes, no key material. use std::path::PathBuf; fn main() { let dir = PathBuf::from(std::env::args().nth(1).expect("usage: check_identity DIR")); let record = std::fs::read(dir.join("validation_record.cms")).expect("validation_record.cms"); match airdrop::apple::verify_record(&record) { Ok(rec) => println!( "record: signed by Apple, account {}, {} validated identifiers, expired: {}", rec.account, rec.hashes.len(), rec.is_expired_at(std::time::SystemTime::now()) ), Err(error) => println!("record: REJECTED: {error}"), } let pem = std::fs::read(dir.join("certificate.pem")).expect("certificate.pem"); for cert in airdrop::apple::certificates_from_pem(&pem) { use der::Encode; let der = cert.to_der().unwrap(); match airdrop::apple::certificate_account(&der, &[]) { Some(account) => println!("certificate: chains to Apple Root CA, account {account}"), None => println!("certificate: does NOT chain to Apple Root CA"), } } }