Remove cardholder_certificate from the public CardClient API, for now (until we learn of actual use cases for this part of the spec).

This commit is contained in:
Heiko Schaefer 2022-02-15 16:07:05 +01:00
parent 574d7be765
commit 889eedbb79
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D
2 changed files with 61 additions and 60 deletions

View file

@ -391,65 +391,65 @@ pub fn test_private_data(
Ok(out) Ok(out)
} }
pub fn test_cardholder_cert( // pub fn test_cardholder_cert(
card_client: &mut (dyn CardClient + Send + Sync), // card_client: &mut (dyn CardClient + Send + Sync),
_param: &[&str], // _param: &[&str],
) -> Result<TestOutput, TestError> { // ) -> Result<TestOutput, TestError> {
let mut out = vec![]; // let mut out = vec![];
//
println!(); // println!();
//
match card_client.cardholder_certificate() { // match card_client.cardholder_certificate() {
Ok(res) => { // Ok(res) => {
out.push(TestResult::Text(format!("got cert {:x?}", res.data()))) // out.push(TestResult::Text(format!("got cert {:x?}", res.data())))
} // }
Err(e) => { // Err(e) => {
out.push(TestResult::Text(format!( // out.push(TestResult::Text(format!(
"get_cardholder_certificate failed: {:?}", // "get_cardholder_certificate failed: {:?}",
e // e
))); // )));
return Ok(out); // return Ok(out);
} // }
}; // };
//
card_client.verify_pw3("12345678")?; // card_client.verify_pw3("12345678")?;
//
let data = "Foo bar baz!".as_bytes(); // let data = "Foo bar baz!".as_bytes();
//
match card_client.set_cardholder_certificate(data.to_vec()) { // match card_client.set_cardholder_certificate(data.to_vec()) {
Ok(_resp) => out.push(TestResult::Text("set cert ok".to_string())), // Ok(_resp) => out.push(TestResult::Text("set cert ok".to_string())),
Err(e) => { // Err(e) => {
out.push(TestResult::Text(format!( // out.push(TestResult::Text(format!(
"set_cardholder_certificate: {:?}", // "set_cardholder_certificate: {:?}",
e // e
))); // )));
return Ok(out); // return Ok(out);
} // }
} // }
//
let res = card_client.cardholder_certificate()?; // let res = card_client.cardholder_certificate()?;
out.push(TestResult::Text("get cert ok".to_string())); // out.push(TestResult::Text("get cert ok".to_string()));
//
if res.data() != data { // if res.data() != data {
out.push(TestResult::Text(format!( // out.push(TestResult::Text(format!(
"get after set doesn't match original data: {:x?}", // "get after set doesn't match original data: {:x?}",
data // data
))); // )));
return Ok(out); // return Ok(out);
}; // };
//
// try using slot 2 // // try using slot 2
//
match card_client.select_data(2, &[0x7F, 0x21]) { // match card_client.select_data(2, &[0x7F, 0x21]) {
Ok(_res) => out.push(TestResult::Text("select_data ok".to_string())), // Ok(_res) => out.push(TestResult::Text("select_data ok".to_string())),
Err(e) => { // Err(e) => {
out.push(TestResult::Text(format!("select_data: {:?}", e))); // out.push(TestResult::Text(format!("select_data: {:?}", e)));
return Ok(out); // return Ok(out);
} // }
} // }
//
Ok(out) // Ok(out)
} // }
pub fn test_pw_status( pub fn test_pw_status(
card_client: &mut (dyn CardClient + Send + Sync), card_client: &mut (dyn CardClient + Send + Sync),

View file

@ -295,7 +295,8 @@ impl<'a> dyn CardClient + 'a {
/// ///
/// Call select_data() before calling this fn, to select a particular /// Call select_data() before calling this fn, to select a particular
/// certificate (if the card supports multiple certificates). /// certificate (if the card supports multiple certificates).
pub fn cardholder_certificate(&mut self) -> Result<Response, Error> { #[allow(dead_code)]
fn cardholder_certificate(&mut self) -> Result<Response, Error> {
let cmd = commands::cardholder_certificate(); let cmd = commands::cardholder_certificate();
apdu::send_command(self, cmd, true)?.try_into() apdu::send_command(self, cmd, true)?.try_into()
} }