openpgp-card: adjust debug hex format for easier re-use of the output

Thanks to @sosthene-nitrokey for the suggestion :)
This commit is contained in:
Heiko Schaefer 2023-08-17 13:57:12 +02:00
parent b19d6ca305
commit 99ca7f4882
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D
2 changed files with 7 additions and 7 deletions

View file

@ -29,7 +29,7 @@ pub(crate) fn send_command<C>(
where where
C: CardTransaction + ?Sized, C: CardTransaction + ?Sized,
{ {
log::debug!(" -> full APDU command: {:x?}", cmd); log::debug!(" -> full APDU command: {:02x?}", cmd);
let mut resp = RawResponse::try_from(send_command_low_level( let mut resp = RawResponse::try_from(send_command_low_level(
card_tx, card_tx,
@ -69,7 +69,7 @@ where
} }
log::debug!( log::debug!(
" <- APDU response [len {}]: {:x?}", " <- APDU response [len {}]: {:02x?}",
resp.raw_data().len(), resp.raw_data().len(),
resp resp
); );
@ -158,11 +158,11 @@ where
let serialized = partial.serialize(ext_len, expect_response)?; let serialized = partial.serialize(ext_len, expect_response)?;
log::trace!(" -> chained APDU command: {:x?}", &serialized); log::trace!(" -> chained APDU command: {:02x?}", &serialized);
let resp = card_tx.transmit(&serialized, buf_size)?; let resp = card_tx.transmit(&serialized, buf_size)?;
log::trace!(" <- APDU response: {:x?}", &resp); log::trace!(" <- APDU response: {:02x?}", &resp);
if resp.len() < 2 { if resp.len() < 2 {
return Err(Error::ResponseLength(resp.len())); return Err(Error::ResponseLength(resp.len()));
@ -200,11 +200,11 @@ where
return Err(Error::CommandTooLong(serialized.len())); return Err(Error::CommandTooLong(serialized.len()));
} }
log::trace!(" -> APDU command: {:x?}", &serialized); log::trace!(" -> APDU command: {:02x?}", &serialized);
let resp = card_tx.transmit(&serialized, buf_size)?; let resp = card_tx.transmit(&serialized, buf_size)?;
log::trace!(" <- APDU response: {:x?}", resp); log::trace!(" <- APDU response: {:02x?}", resp);
Ok(resp) Ok(resp)
} }

View file

@ -128,7 +128,7 @@ pub trait CardTransaction {
let resp = apdu::send_command(self, ad, true)?; let resp = apdu::send_command(self, ad, true)?;
let value = Value::from(resp.data()?, true)?; let value = Value::from(resp.data()?, true)?;
log::trace!(" ARD value: {:x?}", value); log::trace!(" ARD value: {:02x?}", value);
Ok(ApplicationRelatedData(Tlv::new( Ok(ApplicationRelatedData(Tlv::new(
Tags::ApplicationRelatedData, Tags::ApplicationRelatedData,