Fix reading EstEID certificates with T=0 (#1193)
This commit is contained in:
parent
f1aa2a61c9
commit
514f898671
@ -365,15 +365,20 @@ static int mcrd_init(sc_card_t * card)
|
||||
if(apdu.sw1 != 0x90 && apdu.sw2 != 0x00)
|
||||
{
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xA4, 0x04, 0x00);
|
||||
apdu.lc = sizeof(EstEID_v35_AID);
|
||||
apdu.data = EstEID_v35_AID;
|
||||
apdu.datalen = sizeof(EstEID_v35_AID);
|
||||
apdu.resplen = 0;
|
||||
apdu.le = 0;
|
||||
apdu.lc = sizeof(EstEID_v35_AID);
|
||||
apdu.data = EstEID_v35_AID;
|
||||
apdu.datalen = sizeof(EstEID_v35_AID);
|
||||
apdu.resplen = 0;
|
||||
apdu.le = 0;
|
||||
r = sc_transmit_apdu(card, &apdu);
|
||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
|
||||
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "SELECT AID: %02X%02X", apdu.sw1, apdu.sw2);
|
||||
if (apdu.sw1 != 0x90 && apdu.sw2 != 0x00) {
|
||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
|
||||
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "SELECT AID: %02X%02X", apdu.sw1, apdu.sw2);
|
||||
if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
|
||||
// Force EstEID 3.5 card recv size 255 with T=0 to avoid recursive read binary
|
||||
// sc_read_binary cannot handle recursive 61 00 calls
|
||||
if (card->reader && card->reader->active_protocol == SC_PROTO_T0)
|
||||
card->max_recv_size = 255;
|
||||
} else {
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xA4, 0x04, 0x00);
|
||||
apdu.lc = sizeof(AzeDIT_v35_AID);
|
||||
apdu.data = AzeDIT_v35_AID;
|
||||
|
Loading…
Reference in New Issue
Block a user