From 5eea5c861dbe962354239e617e1eaee4b3c40e5c Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Mon, 1 Nov 2021 21:58:08 +0100 Subject: [PATCH] When card returns OkBytesAvailable(), use the returned number of bytes from sw2 when asking for the next response. This approach solved problems with "GET RESULT" with a "Feitian Java Card D11CR" running the ykneo applet. --- openpgp-card/src/apdu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpgp-card/src/apdu.rs b/openpgp-card/src/apdu.rs index 2d0496c..1180b6a 100644 --- a/openpgp-card/src/apdu.rs +++ b/openpgp-card/src/apdu.rs @@ -45,7 +45,7 @@ pub(crate) fn send_command( )?)?; } - while let StatusBytes::OkBytesAvailable(_) = resp.status() { + while let StatusBytes::OkBytesAvailable(bytes) = resp.status() { // More data is available for this command from the card log::debug!(" chained response, getting more data"); @@ -53,7 +53,7 @@ pub(crate) fn send_command( let next = RawResponse::try_from(send_command_low_level( card_client, commands::get_response(), - Expect::Some, + Expect::Short(bytes), )?)?; match next.status() {