Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace openssl hash functions with RustCrypto hashes #3

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ pcsc = "2.8.2"
cipher = { version = "0.4.4", features = ["block-padding", "alloc"] }
des = "0.8.1"
aes = "0.8.4"
ecb = "0.1.2"
cbc = "0.1.2"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
digest = "0.10.7"
md-5 = "0.10.6"
sha1-checked = "0.10.0"
sha2 = "0.10.8"
constant_time_eq = "0.3.1"
Expand All @@ -29,9 +30,9 @@ 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}

[dev-dependencies]
num-bigint = "0.4.6"
hex-literal = "0.4.1"

[features]
default = ["passive_auth"]
passive_auth = ["dep:openssl", "dep:rasn", "dep:rasn-cms", "dep:rasn-pkix"]
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
Loading