Handle PIN failures
This commit is contained in:
parent
bb8d954510
commit
3636245aa7
7 changed files with 127 additions and 84 deletions
|
|
@ -42,16 +42,7 @@ impl Card for PCSCCard {
|
|||
apdu_buf.push(apdu.expected_length.unwrap_or_default() as u8);
|
||||
}
|
||||
|
||||
let ret_len = self
|
||||
.card
|
||||
.transmit(&apdu_buf, &mut self.buf)
|
||||
.map_err(|f| std::io::Error::new(std::io::ErrorKind::BrokenPipe, f))?
|
||||
.len();
|
||||
|
||||
let data = self.buf[..ret_len - 2].to_vec();
|
||||
let sw = (self.buf[ret_len - 2] as u16) << 8 | (self.buf[ret_len - 1] as u16);
|
||||
|
||||
Ok(ResultAPDU { data, status: sw })
|
||||
self.transmit_raw(&apdu_buf).await
|
||||
}
|
||||
async fn transmit_raw(&mut self, apdu_buf: &[u8]) -> std::io::Result<crate::ResultAPDU> {
|
||||
let ret_len = self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue