Skip to content

Commit

Permalink
WIP implementation of certificate verification
Browse files Browse the repository at this point in the history
  • Loading branch information
Fethbita committed Oct 27, 2024
1 parent 62714b4 commit 85017e9
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 213 deletions.
18 changes: 14 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ openssl = { version = "0.10.66", features = ["vendored"], optional = true }
rasn = { version = "0.16.6", optional = true}
rasn-cms = { version = "0.16.6", optional = true}
rasn-pkix = { version = "0.16.6", optional = true}
num-bigint = "0.4.6"

[dev-dependencies]
hex-literal = "0.4.1"
Expand Down
6 changes: 3 additions & 3 deletions examples/read_emrtd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@ fn main() -> Result<(), EmrtdError> {
csca_cert_store.all_certificates().len()
);
result = passive_authentication(&ef_sod, &csca_cert_store).unwrap();
info!("{:?} {:?} {:?}", result.0.type_(), result.1, result.2);
info!("{:?} {:?}", result.1, result.2);
}

// Read EF.DG1
sm_object.select_ef(b"\x01\x01", "EF.DG1", true)?;
let ef_dg1 = sm_object.read_data_from_ef(true)?;
info!("Data from the EF.DG1: {}", bytes2hex(&ef_dg1));
#[cfg(feature = "passive_auth")]
validate_dg(&ef_dg1, 1, result.0, &result.1)?;
validate_dg(&ef_dg1, 1, result.0.clone(), &result.1)?;

// Read EF.DG2
sm_object.select_ef(b"\x01\x02", "EF.DG2", true)?;
let ef_dg2 = sm_object.read_data_from_ef(true)?;
info!("Data from the EF.DG2: {}", bytes2hex(&ef_dg2));
#[cfg(feature = "passive_auth")]
validate_dg(&ef_dg2, 2, result.0, &result.1)?;
validate_dg(&ef_dg2, 2, result.0.clone(), &result.1)?;

let jpeg = get_jpeg_from_ef_dg2(&ef_dg2)?;
std::fs::write("face.jpg", jpeg).expect("Error writing file");
Expand Down
Loading

0 comments on commit 85017e9

Please sign in to comment.