Search code examples
authenticationsmartcardapduiccemv

How to set and update ICC card PIN with APDU command


I have a contact smartcard.(I dont know about what kind of applet installed on it. But I can authenticate, read, update and verify pin with standart APDU commands.) And I want to do some changes on PIN. So, my question is:

  • If card has PIN, then update the PIN with new value. If card dont have any PIN, then set PIN.

Standart update command is not working on PIN file. I am getting 6982 response message from ICC card. So, what is the approach to success above situation. I searched on internet about it, But I didnt find any useful Docs&Articles.


Solution

  • Finaly I found solution, and I am putting the answer here.

    Firstly, we need to select PIN FILE. For this

    • Select MF(Master File)
    • Select DF(Dedicated file)
    • Select PIN EF (Elementry file)

    Select App Master File : 00 A4 00 00 02 XX XX

    Select App Dedicated File : 00 A4 00 00 02 XX XX

    Select App Pin File : 00 A4 00 00 02 XX XX

    Change Pin coommand: 00 24 [TM] [KN] [LN] XX XX .. ..

    TM: Transfer Mode (Clear Transfer) : 00 KN: Key Number: 10 LN: Total Pin Length(Every time 16 bytes): 10

    For example (Old pin is “1234” and we want to change pin to “5678”:

    Change Pin : 00 24 00 10 10 31 32 33 34 FF FF FF FF 35 36 37 38 FF FF FF FF (FF: padding value)