SimProbe

Reading an ICCID and its EF_ICCID encoding

EF_ICCID stores digits in swapped-nibble BCD. Convert between that encoding and the printed ICCID, and see how the Luhn check digit works.

  • IDNTEQ
  • Classic SIM
  • ICCID
  • ITU-T E.118
  • EF_ICCID

The printed ICCID and the bytes stored on the card in EF_ICCID use different representations. A printed ICCID starting 8955… is stored in EF_ICCID as the bytes 98 55 ….

What an ICCID is (ITU-T E.118)

An ICCID is the serial number of a SIM. Its ITU-T E.118 layout starts with the MII (89 for telecommunications, the ISO/IEC 7812 major industry identifier) and the variable-length E.164 country code. These are followed by the issuer identifier (assigned to the card issuer), the individual account number and a Luhn check digit. That digit is an ISO/IEC 7812 checksum over everything before it.

The Luhn check digit

A failed Luhn check usually means a mistyped or truncated number. The ICCID parser shows the digit it should have been, which helps find a single-digit transcription error.

Validate the full number, including the check digit, rather than the payload alone.

The nibble-swap: printed ICCID vs EF_ICCID

EF_ICCID (FID 2FE2, directly under the MF) stores the ICCID as BCD with the two nibbles of every byte swapped, and pads an odd number of digits with a trailing F.

The raw EF_ICCID bytes do not match the printed number until each byte is un-swapped. Paste either the printed digits or the raw hex into the parser and it detects and un-swaps automatically.

Keep track of the trailing F padding when counting the length; dropping it can lead to a miscount.

Generating a valid ICCID

Test cards often need a valid ICCID for a given prefix. Generate mode takes an 89 + country-code + issuer prefix and a length, fills the body, computes the Luhn check digit, and also emits the on-card BCD form so you can write it straight to EF_ICCID.

Related

The tool this article refers to, and the related consulting service.