Amatukami
Amatukami

Reputation: 93

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

Upvotes: 2

Views: 4057

Answers (2)

shyam maheshwari
shyam maheshwari

Reputation: 1

Your length should be 0x10. Plz refer below example: A0 2C 00 01 10 3636303535333132 31323334 FFFFFFFF

Command : A0 2C 00 01 10 Input Data : 36 36 30 35 35 33 31 32 31 32 33 34 FF FF FF FF
Output Data : none Status : 90 00

here 3636303535333132 is unblock key and 31323334 is new pin

Upvotes: 0

Michael Roland
Michael Roland

Reputation: 40851

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)

  • P1 = 0x00 (for the format you tried):

    00 2C 00 01 0C 36 35 32 34 39 38 37 36 31 32 33 34
    
  • P1 = 0x02 (only the new reference data is sent):

    00 2C 02 01 04 31 32 33 34
    

Upvotes: 1

Related Questions