| 269 |
pin_verify -> bmPINBlockString = 0x04; |
pin_verify -> bmPINBlockString = 0x04; |
| 270 |
pin_verify -> bmPINLengthFormat = 0x00; |
pin_verify -> bmPINLengthFormat = 0x00; |
| 271 |
pin_verify -> wPINMaxExtraDigit = HOST_TO_CCID(0x0408); /* Min Max */ |
pin_verify -> wPINMaxExtraDigit = HOST_TO_CCID(0x0408); /* Min Max */ |
| 272 |
pin_verify -> bEntryValidationCondition = 0x02; |
pin_verify -> bEntryValidationCondition = 0x02; /* validation key pressed */ |
| 273 |
pin_verify -> bNumberMessage = 0x00; |
pin_verify -> bNumberMessage = 0x00; |
| 274 |
pin_verify -> wLangId = HOST_TO_CCID(0x0904); |
pin_verify -> wLangId = HOST_TO_CCID(0x0904); |
| 275 |
pin_verify -> bMsgIndex = 0x00; |
pin_verify -> bMsgIndex = 0x00; |
| 352 |
pin_modify -> bmFormatString = 0x82; |
pin_modify -> bmFormatString = 0x82; |
| 353 |
pin_modify -> bmPINBlockString = 0x04; |
pin_modify -> bmPINBlockString = 0x04; |
| 354 |
pin_modify -> bmPINLengthFormat = 0x00; |
pin_modify -> bmPINLengthFormat = 0x00; |
| 355 |
pin_modify -> bInsertionOffsetOld = 0x00; |
pin_modify -> bInsertionOffsetOld = 0x05; /* offset from APDU start */ |
| 356 |
pin_modify -> bInsertionOffsetNew = 0x00; |
pin_modify -> bInsertionOffsetNew = 0x0D; /* offset from APDU start */ |
| 357 |
pin_modify -> wPINMaxExtraDigit = HOST_TO_CCID(0x0408); /* Min Max */ |
pin_modify -> wPINMaxExtraDigit = HOST_TO_CCID(0x0408); /* Min Max */ |
| 358 |
pin_modify -> bConfirmPIN = 0x00; |
pin_modify -> bConfirmPIN = 0x03; /* b0 set = confirmation requested */ |
| 359 |
pin_modify -> bEntryValidationCondition = 0x02; |
/* b1 set = current PIN entry requested */ |
| 360 |
|
pin_modify -> bEntryValidationCondition = 0x02; /* validation key pressed */ |
| 361 |
pin_modify -> bNumberMessage = 0x00; |
pin_modify -> bNumberMessage = 0x00; |
| 362 |
pin_modify -> wLangId = HOST_TO_CCID(0x0904); |
pin_modify -> wLangId = HOST_TO_CCID(0x0904); |
| 363 |
pin_modify -> bMsgIndex1 = 0x00; |
pin_modify -> bMsgIndex1 = 0x00; |
| 366 |
pin_modify -> bTeoPrologue[0] = 0x00; |
pin_modify -> bTeoPrologue[0] = 0x00; |
| 367 |
pin_modify -> bTeoPrologue[1] = 0x00; |
pin_modify -> bTeoPrologue[1] = 0x00; |
| 368 |
pin_modify -> bTeoPrologue[2] = 0x00; |
pin_modify -> bTeoPrologue[2] = 0x00; |
| 369 |
pin_modify -> ulDataLength = 0x0D; |
/* pin_modify -> ulDataLength = 0x00; we don't know the size yet */ |
| 370 |
|
|
| 371 |
/* APDU: 00 20 00 00 08 30 30 30 30 00 00 00 00 */ |
/* APDU: 00 20 00 00 08 30 30 30 30 00 00 00 00 */ |
| 372 |
offset = 0; |
offset = 0; |
| 373 |
pin_modify -> abData[offset++] = 0x00; /* CLA */ |
pin_modify -> abData[offset++] = 0x00; /* CLA */ |
| 374 |
pin_modify -> abData[offset++] = 0x20; /* INS: VERIFY */ |
pin_modify -> abData[offset++] = 0x24; /* INS: CHANGE/UNBLOCK */ |
| 375 |
pin_modify -> abData[offset++] = 0x00; /* P1 */ |
pin_modify -> abData[offset++] = 0x00; /* P1 */ |
| 376 |
pin_modify -> abData[offset++] = 0x00; /* P2 */ |
pin_modify -> abData[offset++] = 0x00; /* P2 */ |
| 377 |
pin_modify -> abData[offset++] = 0x08; /* Lc: 8 data bytes */ |
pin_modify -> abData[offset++] = 0x10; /* Lc: 2x8 data bytes */ |
| 378 |
|
pin_modify -> abData[offset++] = 0x30; /* '0' old PIN */ |
| 379 |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 380 |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 381 |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 382 |
|
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 383 |
|
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 384 |
|
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 385 |
|
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 386 |
|
pin_modify -> abData[offset++] = 0x30; /* '0' new PIN */ |
| 387 |
|
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 388 |
|
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 389 |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
pin_modify -> abData[offset++] = 0x30; /* '0' */ |
| 390 |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 391 |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 392 |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 393 |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
pin_modify -> abData[offset++] = 0x00; /* '\0' */ |
| 394 |
|
pin_modify -> ulDataLength = offset; /* APDU size */ |
| 395 |
|
|
| 396 |
|
length = sizeof(PIN_MODIFY_STRUCTURE) + offset -1; /* -1 because PIN_MODIFY_STRUCTURE contains the first byte of abData[] */ |
| 397 |
|
|
|
length = sizeof(PIN_VERIFY_STRUCTURE) + offset -1; |
|
| 398 |
printf(" command:"); |
printf(" command:"); |
| 399 |
for (i=0; i<length; i++) |
for (i=0; i<length; i++) |
| 400 |
printf(" %02X", bSendBuffer[i]); |
printf(" %02X", bSendBuffer[i]); |
| 401 |
printf("\n"); |
printf("\n"); |
| 402 |
printf("Enter your PIN: "); |
printf("Enter your PIN: "); |
| 403 |
fflush(stdout); |
fflush(stdout); |
| 404 |
rv = SCardControl(hCard, verify_ioctl, bSendBuffer, |
rv = SCardControl(hCard, modify_ioctl, bSendBuffer, |
| 405 |
length, bRecvBuffer, sizeof(bRecvBuffer), &length); |
length, bRecvBuffer, sizeof(bRecvBuffer), &length); |
| 406 |
|
|
| 407 |
printf(" card response:"); |
printf(" card response:"); |