authenticationsmartcardapdupin-code

Unblock code PIN with APDU commands: error "67 00" --> Wrong length


By using WinsCard.dll, I want to use APDU commands to reset PIN code and set a new into the smartcard. But when I launch these commands, I obtain error "67 00" ("Wrong length").

My APDU commands:

// First command, I verify the code PUK (return "90 00")
00 20 00 02 08 36 35 32 34 39 38 37 36  
// Second command, I try to set a new code PIN into the card
00 2C 03 01 0C 36 35 32 34 39 38 37 36 31 32 33 34

For second command:

36 35 32 34 39 38 37 36 -> code PUK
31 32 33 34 -> new code PIN

After some searches, the only explanation that I have found is that the "Lc" parameter was wrong. But, in my case, it is equal to "0C", and the length of my data is "0C".

So, I don't understand where is my error.

Have you got an idea?

Thank you very much for your help!

Note: If I reset the code PIN without put a new PIN (it restores previous code PIN), it works fine:

00 20 00 02 08 31 38 39 30 31 36 39 32
// Reset code PIN
00 2C 03 01 00

Solution

  • Using the RESET RETRY COUNTER command (INS = 0x2C) with P1 = 0x03 means that you want to reset the retry counter without setting new reference data (i.e. a new PIN). If you want to set new reference data (a new PIN) when resetting the retry counter, you could try (depending on what your card supports)