Search code examples
c++apdumifare

How to calculate PCB byte for apdu command


I need simple example for calculate PCB bit for APDU command. For example I have command select aplet:

{ 0x00, 0xA4, 0x04, 0x00, 0x06, 0x9A, 0xFC, 0xC3, 0x22, 0x88, 0x91 };

were byte is:

  • CLA
  • INS
  • P1
  • P2
  • Len
  • Aplet ID(6 byte)

How I can calculate PCB for its command?

I know that it byte must be '0x02', but how to calculate it dynamically?

Thank you!


Solution

  • Google Books has the "Smart Card Handbook By Wolfgang Rankl, Wolfgang Effing". It has tables 9-5 through 9-7 which give the PCB format.