mirror of
https://github.com/NinjaCheetah/rustii.git
synced 2025-06-05 23:11:02 -04:00
Some checks are pending
Build rustii / build-linux-x86_64 (push) Waiting to run
Build rustii / build-macos-arm64 (push) Waiting to run
Build rustii / build-macos-x86_64 (push) Waiting to run
Build rustii / build-windows-x86_64 (push) Waiting to run
rustii CLI info command now displays the signing status of TMDs/Tickets/WADs like WiiPy does, and displays the ASCII TID for a title when applicable. This means that this command now has full feature parity with WiiPy.
45 lines
2.1 KiB
Rust
45 lines
2.1 KiB
Rust
// Sample file for testing rustii library stuff.
|
|
|
|
use std::fs;
|
|
use rustii::title::{wad, cert};
|
|
use rustii::title;
|
|
|
|
fn main() {
|
|
let data = fs::read("sm.wad").unwrap();
|
|
let title = title::Title::from_bytes(&data).unwrap();
|
|
println!("Title ID from WAD via Title object: {}", hex::encode(title.tmd.title_id));
|
|
|
|
let wad = wad::WAD::from_bytes(&data).unwrap();
|
|
println!("size of tmd: {:?}", wad.tmd().len());
|
|
println!("num content records: {:?}", title.tmd.content_records.len());
|
|
println!("first record data: {:?}", title.tmd.content_records.first().unwrap());
|
|
println!("TMD is fakesigned: {:?}",title.tmd.is_fakesigned());
|
|
|
|
println!("title version from ticket is: {:?}", title.ticket.title_version);
|
|
println!("title key (enc): {:?}", title.ticket.title_key);
|
|
println!("title key (dec): {:?}", title.ticket.dec_title_key());
|
|
println!("ticket is fakesigned: {:?}", title.ticket.is_fakesigned());
|
|
|
|
println!("title is fakesigned: {:?}", title.is_fakesigned());
|
|
|
|
println!("wad header: {:?}", wad.header);
|
|
|
|
let cert_chain = &title.cert_chain;
|
|
println!("cert chain OK");
|
|
let result = cert::verify_ca_cert(&cert_chain.ca_cert()).unwrap();
|
|
println!("CA cert {} verified successfully: {}", cert_chain.ca_cert().child_cert_identity(), result);
|
|
|
|
let result = cert::verify_child_cert(&cert_chain.ca_cert(), &cert_chain.tmd_cert()).unwrap();
|
|
println!("TMD cert {} verified successfully: {}", cert_chain.tmd_cert().child_cert_identity(), result);
|
|
let result = cert::verify_tmd(&cert_chain.tmd_cert(), &title.tmd).unwrap();
|
|
println!("TMD verified successfully: {}", result);
|
|
|
|
let result = cert::verify_child_cert(&cert_chain.ca_cert(), &cert_chain.ticket_cert()).unwrap();
|
|
println!("Ticket cert {} verified successfully: {}", cert_chain.ticket_cert().child_cert_identity(), result);
|
|
let result = cert::verify_ticket(&cert_chain.ticket_cert(), &title.ticket).unwrap();
|
|
println!("Ticket verified successfully: {}", result);
|
|
|
|
let result = title.verify().unwrap();
|
|
println!("full title verified successfully: {}", result);
|
|
}
|