Hi,

I've done some tests to validate my reader's pinpad with my smartcard GnuPG V2

I've put this to CHECKPIN :

        /* PC/SC v2.02.05 Part 10 PIN verification data structure */
        pin_verify -> bTimerOut = 0x00;
        pin_verify -> bTimerOut2 = 0x00;
        pin_verify -> bmFormatString = 0x82;
        pin_verify -> bmPINBlockString = 0x00;
        pin_verify -> bmPINLengthFormat = 0x00;
        pin_verify -> wPINMaxExtraDigit = HOST_TO_CCID_16(0x0408); /* Min Max */
        pin_verify -> bEntryValidationCondition = 0x02; /* validation key 
pressed */
        pin_verify -> bNumberMessage = 0x01;
        pin_verify -> wLangId = HOST_TO_CCID_16(0x0904);
        pin_verify -> bMsgIndex = 0x00;
        pin_verify -> bTeoPrologue[0] = 0x00;
        pin_verify -> bTeoPrologue[1] = 0x00;
        pin_verify -> bTeoPrologue[2] = 0x00;
        /* pin_verify -> ulDataLength = 0x00; we don't know the size yet */

        /* APDU: 00 20 00 82 06 31 32 33 34 35 36 00 00 smartcard GnuPG V2*/
        offset = 0;
        pin_verify -> abData[offset++] = 0x00;  /* CLA */
        pin_verify -> abData[offset++] = 0x20;  /* INS: VERIFY */
        pin_verify -> abData[offset++] = 0x00;  /* P1 */
        pin_verify -> abData[offset++] = 0x82;  /* P2 */
        pin_verify -> abData[offset++] = 0x06;  /* Lc: 8 data bytes */
        pin_verify -> abData[offset++] = 0x31;  /* '0' */
        pin_verify -> abData[offset++] = 0x32;  /* '0' */
        pin_verify -> abData[offset++] = 0x33;  /* '0' */
        pin_verify -> abData[offset++] = 0x34;  /* '0' */
        pin_verify -> abData[offset++] = 0x35;  /* '\0' */
        pin_verify -> abData[offset++] = 0x36;  /* '\0' */
        pin_verify -> abData[offset++] = 0x00;  /* '\0' */
        pin_verify -> abData[offset++] = 0x00;  /* '\0' */
        pin_verify -> ulDataLength = HOST_TO_CCID_32(offset);   /* APDU size */

But I've this answer :

 Reader: Covadis Vega (000000F5) 00 00 (length 30 bytes)
 State: 0x190034
 Prot: 0
 ATR (length 21 bytes): 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 
90 00 0C
SCardStatus: OK

 Protocol: 2
SCardReconnect: OK

 Secure verify PIN
 command: 00 00 82 00 00 08 04 02 01 04 09 00 00 00 00 0D 00 00 00 00 20 00 82 
06 31 32 33 34 35 36 00 00
Enter your PIN: 
 card response: 67 00
SCardControl: OK


verify PIN dump:  00 40 00 00 FF
 card response: 6D 00
SCardTransmit: OK


So if I anderstand : I've a problem with a Wrong length (Lc and/or Le) and with 
the Instruction (INS) not supported


And for MODIFY PIN, I've put this :


        /* PC/SC v2.02.05 Part 10 PIN modification data structure *
        pin_modify -> bTimerOut = 0x00;
        pin_modify -> bTimerOut2 = 0x00;
        pin_modify -> bmFormatString = 0x82;
        pin_modify -> bmPINBlockString = 0x04;
        pin_modify -> bmPINLengthFormat = 0x00;
        pin_modify -> bInsertionOffsetOld = 0x00;       /* offset from APDU 
start */
        pin_modify -> bInsertionOffsetNew = 0x04;       /* offset from APDU 
start */
        pin_modify -> wPINMaxExtraDigit = HOST_TO_CCID_16(0x0408);      /* Min 
Max */
        pin_modify -> bConfirmPIN = 0x03;       /* b0 set = confirmation 
requested */
                                                                        /* b1 
set = current PIN entry requested */
        pin_modify -> bEntryValidationCondition = 0x02; /* validation key 
pressed */
        pin_modify -> bNumberMessage = 0x03; /* see table above */
        pin_modify -> wLangId = HOST_TO_CCID_16(0x0904);
        pin_modify -> bMsgIndex1 = 0x00;
        pin_modify -> bMsgIndex2 = 0x00;
        pin_modify -> bMsgIndex3 = 0x00;
        pin_modify -> bTeoPrologue[0] = 0x00;
        pin_modify -> bTeoPrologue[1] = 0x00;
        pin_modify -> bTeoPrologue[2] = 0x00;
        /* pin_modify -> ulDataLength = 0x00; we don't know the size yet */

        /* APDU: 00 24 00 81 0C 31 32 33 34 35 36 00 00 smartcard GnuPG V2*/
        offset = 0;
        pin_modify -> abData[offset++] = 0x00;  /* CLA */
        pin_modify -> abData[offset++] = 0x24;  /* INS: CHANGE/UNBLOCK */
        pin_modify -> abData[offset++] = 0x00;  /* P1 */
        pin_modify -> abData[offset++] = 0x81;  /* P2 */
        pin_modify -> abData[offset++] = 0x0C;  /* Lc: 2x8 data bytes */
        pin_modify -> abData[offset++] = 0x31;  /* '0' old PIN */
        pin_modify -> abData[offset++] = 0x32;  /* '0' */
        pin_modify -> abData[offset++] = 0x33;  /* '0' */
        pin_modify -> abData[offset++] = 0x34;  /* '0' */
        pin_modify -> abData[offset++] = 0x35;  /* '0' new PIN */
        pin_modify -> abData[offset++] = 0x36;  /* '0' */
        pin_modify -> abData[offset++] = 0x00;  /* '0' */
        pin_modify -> abData[offset++] = 0x00;  /* '0' */
        pin_modify -> ulDataLength = HOST_TO_CCID_32(offset);   /* APDU size */

but I've this answer :


 Secure modify PIN
 command: 00 00 82 04 00 00 04 08 04 03 02 03 04 09 00 00 00 00 00 00 0D 00 00 
00 00 24 00 81 0C 31 32 33 34 35 36 00 00
Enter your PIN:  card response: 67 00
SCardControl: OK


modify PIN dump:  00 40 00 00 FF
 card response: 6D 00
SCardTransmit: OK

SCardDisconnect: OK


So if I anderstand : I've also a problem with a Wrong length (Lc and/or Le) and 
with the Instruction (INS) not supported



Could you give me the good APDU in this two case ?

Thanks in advanced.

Best Ragerds.

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to