Wednesday, November 15, 2017

so...how do they encode the information? (ID cards)

High Programmer > Alan De Smet > Unique ID > Machine Readable Passport Zone

Machine Readable Passport Zone

The International Civil Aviation Organization, a Quebec based group, developed standards for Machine Readable Travel Documents (MRTDs), including passports and visas. These MRTD make it easy for automated systems to scan a travel document. If a country decides to check all visitors against a known criminals data reading the information automatically with a computer will be much faster and less prone to error than if the immagration agent needs to type the information in by hand.
The MRTD standards are encoded in ICAO Document 9303. Part 1 documents Machine Readable Passports (MRPs). This standard was accepted by the International Standards Organization as ISO/IEC 7501-1:1997ISO/IEC 7501-2:1997, and ISO/IEC 7501-03:1997.
If you're interested in original materials, do not bother with the ISO versions. These $27 documents (well, 34,00 CHF) are are essentially a single page saying, "See ICAO Document 9303". ICAO 9303 is much better and includes several pages documenting the history of the document. It's a bit expensive at $62. You might be able to get it through inter-library loan. I borrowed a copy of the much briefer 3rd edition this way. The 5th edition is much larger (126 pages versus the 30 or so), but I don't access to the 5th edition and am unable to comment on what has been added in the remaining 100 pages.
MRTD's have a Machine Readable Zone (MRZ) at the bottom of them. These MRZes are printed in the monospace font OCR-B. It is printed as "Size 1", which works out to be about 14 point. Further details on the font can be found in ISO Standard 1073-2:1976. The exact location of the MRZ, the type of paper, reflectivity and the like are futher documented in ICAO 9303 and ISO 1831:1980.
On a MR Passport there are two lines. Each line is 44 characters long. There are no blank spaces; where one is necessary is it filled with the filler character, a less than sign (<). Here is an example from ICAO 9303. This person is from the fictional country of Utopia, the country code (UTO) is invalid. I've reformatted it to be similar to a United States passport.

PASSPORT
PASSEPORT
PASAPORTE

UTOPIA

Type / Type / Tipo
P
Code / Code / Cédigo
UTO
Passport No. / No. du Passeport / No. de Pasaporte
L898902C
Surname / Nom / Apellidos
ERIKSSON
Given names / Prénoms / Nombres
ANNA MARIA
Nationality / Nationalité / Nacionalidad
UTOPIAN
Date of birth / Date de naissance / Fecha de nacimiento
06 Aug 1969
Personal no / no personnel
ZE184226B
Sex / Dexe / Sexo
F
Place of birth / Lieu de naissance / Lugar de nacimiento
ZENITH, UTOPIA
Date of Issue / Date de délivrance / Fecha de expedición
24 Jun 1989
Authority / Autorité / Autoridad
Passport Office
Date of expiration / Date d' expiration / Fecha de caducidad
23 Jun 1994
Ammendments / Modifications / Enmiendas
See Page 24
P
Notable differences between the example data and an actual US passport:
  • The Place of Birth (if in the United States) will be in the form "State, U.S.A."
  • The Authority will specify the city of the passport office (New Orleans is one possibility
  • Passport numbers are 9 digits with no letters.
  • There is no personal number.
  • Type, Code, and Passport No. are on the same line. Sex and Place of birth are on the same line. Date of issue and Authority are on the same line. (I haven't figured out how to format it correctly without some tortorous HTML.)
So here is the example MRZ.
P
Here are the fields:
Ptiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
#########CbbbYYMMDDCsyymmddCppppppppppppppCX

General Notes

All fields are padded with less than signs (<) to fill the required width. There should be no whitespace in the MRZ. Only letters A through Z, digits 0 through 9, and the filler character < are allowed. Some extended letters are mapped to other sets of characters per the following table. The alternate encoding is used when the normal encoding might caused confusion between different names.
CharacterEncodingAlternate Encoding
ÄAE
ÅAA
ÆAE
IJIJ
IJIJ
ÑNNXX
ÖOE
ØOE
ÜUEUXX
ßSS

P - Passport

The first letter is "P", designating a passport.

t - Passport Type

The second character can be assigned by the issuing country to distinguish different types of passports. If unused a < is assigned.
The United States, at least in the cases I've seen, doesn't use this field.
In the example above there is a <, apparently the fictional country of Utopia doesn't specify specific types, or Anna doesn't need one.

iii - Issuing Country or Organization

The issuing country or organization, encoded in three characters. The code is pulled from this table.
In the example above the code is UTO. This code doesn't exist; it's the fictional country of Utopia for the example.

nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - Name

This field is the passport holder's name. The general format is "LAST". The name is entirely upper case. Puncuation (like hyphens) are replaced with the filler character < The surname is given first, then the filler character twice (<<), then the remainder of given names. Separate names in the surname or given name are separated with the filler character < The filler character < pads out the field to fill 39 characters.
Suffixes (Jr, Sr, II, III, etc) are encoded as part of the last name, without punctuation.
If the name is too long to fit the most significant parts of the name are used. Names may abbreviated if necessary to make them fit.
In the above example Anna's surname is Eriksson, her first and middle names are Anna and Maria. Her name is encoded as
ERIKSSON<
George Michael Richards-Stevens Jr. would be encoded as
RICHARDS

######### - Passport Number

This is the passport number, as assigned by the issuing country. Each country is free to assign numbers using any system it likes. If the number has non-letter or number characters they are replaced with the filler character <.

C - Check digit

Check digits are calculated based on the previous field. Thus, the first check digit is based on the passport number, the next is based on the date of birth, the next on the expiration date, and the next on the personal number. The check digit is calculated using this algorithm.

bbb - Nationality

The issuing country or organization, encoded in three characters. The code is pulled from this table.
In the example above the code is UTO. This code doesn't exist; it's the fictional country of Utopia for the example.

YYMMDD - Date of Birth

The date of the passport holder's birth in YYMMDD form. Year is truncated to the least significant two digits. Single digit months or days are prepended with 0.
In the example Anna was born in August 6th, 1969. That encodes as "690806".

s - Sex

Sex of the passport holder, M for males, F for females, and < for non-specified.
Anna is female, so "F".

yymmdd - Passport Expiration Date

The date the passport expires in YYMMDD form. Year is truncated to the least significant two digits. Single digit months or days are prepended with 0.
Anna's passport expired on June 23rd, 1994 and is encoded "940623".

pppppppppppppp - Personal Number

This field can be used for any purpose that the issuing country desires.
The United States uses this field in some unknown way. My personal passport has a single digit number in the field.
Anna's personal number is ZE184226B, this field is encoded "ZE184226B<<<<<".

X - Final check digit

This is a check digit for positions 1 to 10, 14 to 20, and 22 to 43 on the second line. Thus, the nationality and sex are not included in the check. The check digit is calculated using this algorithm.

Check Digit Calculations

First, break the input into individual characteres and numbers.
Next, convert non-digits into numbers. A through Z are encoded to 10 through 25. The filler character < is encoded as 0.
<ABCDEFGHIJKLMNOPQRSTUVWXYZ
01011121314151617181920212223242526272829303132333435
Now, multiply each number by the corresponding weighting. The first digit is multipled by 7, the next by 3, and the next by 1. The pattern then repeats (7, 3, 1, 7, 3, 1, 7, 3, 1, etc).
Add up the results, then divide by 10. The remainder is the check digit.
As a special case, if the personal number on the second line is not used (and thus entirely filled with the filler character <), the check digit for that section can be replaced with the filler character <.
An example for the input AB2134:
Input:A B 2 1 3 4 < < <
Value:10 11 2 1 3 4 0 0 0
Weight:7 3 1 7 3 1 7 3 1
Products:70 33 2 7 9 4 0 0 0
Sum:70+33+2+7+9+4+0+0+0=125
Division: 125 ÷ 10 = 12, remainder 5

Country / Organization / Special Table

This table is used for both issuing country and nationality. If the code is shorter than 3 characters it is padded to three characters with the filler character <.
The code list is based on the alpha-3 codes in ISO 3166, but is not entirely identical. The United Nations Statistics Division has a free list of ISO 3166 alpha-3 codes.
CountryCode
AfghanistanAFG
AlbaniaALB
AlgeriaDZA
American SamoaASM
AndorraAND
AngolaAGO
AnguillaAIA
AntarcticaATA
Antigua and BarbudaATG
ArgentinaARG
ArmeniaARM
ArubaABW
AustraliaAUS
AustriaAUT
AzerbaijanAZE
BahamasBHS
BahrainBHR
BangladeshBGD
BarbadosBRB
BelarusBLR
BelgiumBEL
BelizeBLZ
BeninBEN
BermudaBMU
BhutanBTN
BoliviaBOL
Bosnia and HerzegovinaBIH
BotswanaBWA
Bouvet IslandBVT
BrazilBRA
British Indian Ocean TerritoryIOT
Brunei DarussalamBRN
BulgariaBGR
Burkina FasoBFA
BurundiBDI
CambodiaKHM
CameroonCMR
CanadaCAN
Cape VerdeCPV
Cayman IslandsCYM
Central African RepublicCAF
ChadTCD
ChileCHL
ChinaCHN
Christmas IslandCXR
Cocos (Keeling) IslandsCCK
ColombiaCOL
ComorosCOM
CongoCOG
Cook IslandsCOK
Costa RicaCRI
Côte d'IvoireCIV
CroatiaHRV
CubaCUB
CyprusCYP
Czech RepublicCZE
Democratic People's Republic of KoreaPRK
Democratic Republic of the CongoCOD
DenmarkDNK
DjiboutiDJI
DominicaDMA
Dominican RepublicDOM
East TimorTMP
EcuadorECU
EgyptEGY
El SalvadorSLV
Equatorial GuineaGNQ
EritreaERI
EstoniaEST
EthiopiaETH
Falkland Islands (Malvinas)FLK
Faeroe IslandsFRO
FijiFJI
FinlandFIN
FranceFRA
France, MetropolitanFXX
French GuianaGUF
French PolynesiaPYF
GabonGAB
GambiaGMB
GeorgiaGEO
GermanyD
GhanaGHA
GibraltarGIB
GreeceGRC
GreenlandGRL
GrenadaGRD
GuadeloupeGLP
GuamGUM
GuatemalaGTM
GuineaGIN
Guinea-BissauGNB
GuyanaGUY
HaitiHTI
Heard and McDonald IslandsHMD
Holy See (Vatican City State)VAT
HondurasHND
Hong KongHKG
HungaryHUN
IcelandISL
IndiaIND
IndonesiaIDN
Iran, Islamic Republic ofIRN
IraqIRQ
IrelandIRL
IsraelISR
ItalyITA
JamaicaJAM
JapanJPN
JordanJOR
KazakhstanKAZ
KenyaKEN
KiribatiKIR
KuwaitKWT
KyrgyzstanKGZ
Lao People's Democratic RepublicLAO
LatviaLVA
LebanonLBN
LesothoLSO
LiberiaLBR
Libyan Arab JamahiriyaLBY
LiechtensteinLIE
LithuaniaLTU
LuxembourgLUX
MadagascarMDG
MalawiMWI
MalaysiaMYS
MaldivesMDV
MaliMLI
MaltaMLT
Marshall IslandsMHL
MartiniqueMTQ
MauritaniaMRT
MauritiusMUS
MayotteMYT
MexicoMEX
Micronesia, Federated States ofFSM
MonacoMCO
MongoliaMNG
MontserratMSR
MoroccoMAR
MozambiqueMOZ
MyanmarMMR
NamibiaNAM
NauruNRU
NepalNPL
Netherlands, Kingdom of theNLD
Netherlands AntillesANT
Neutral ZoneNTZ
New CaledoniaNCL
New ZealandNZL
NicaraguaNIC
NigerNER
NigeriaNGA
NiueNIU
Norfolk IslandNFK
Northern Mariana IslandsMNP
NorwayNOR
OmanOMN
PakistanPAK
PalauPLW
PanamaPAN
Papua New GuineaPNG
ParaguayPRY
PeruPER
PhilippinesPHL
PitcairnPCN
PolandPOL
PortugalPRT
Puerto RicoPRI
QatarQAT
Republic of KoreaKOR
Republic of MoldovaMDA
RéunionREU
RomaniaROM
Russian FederationRUS
RwandaRWA
Saint HelenaSHN
Saint Kitts and NevisKNA
Saint LuciaLCA
Saint Pierre and MiquelonSPM
Saint Vincent and the GrenadinesVCT
SamoaWSM
San MarinoSMR
Sao Tome and PrincipeSTP
Saudi ArabiaSAU
SenegalSEN
SeychellesSYC
Sierra LeoneSLE
SingaporeSGP
SlovakiaSVK
SloveniaSVN
Solomon IslandsSLB
SomaliaSOM
South AfricaZAF
South Georgia and the South Sandwich IslandSGS
SpainESP
Sri LankaLKA
SudanSDN
SurinameSUR
Svalbard and Jan Mayen IslandsSJM
SwazilandSWZ
SwedenSWE
SwitzerlandCHE
Syrian Arab RepublicSYR
Taiwan Province of ChinaTWN
TajikistanTJK
ThailandTHA
The former Yugoslav Republic of MacedoniaMKD
TogoTGO
TokelauTKL
TongaTON
Trinidad and TobagoTTO
TunisiaTUN
TurkeyTUR
TurkmenistanTKM
Turks and Caicos IslandsTCA
TuvaluTUV
UgandaUGA
UkraineUKR
United Arab EmiratesARE
United Kingdom of Great Britain and Northern Ireland
    - CitizenGBR
    - Dependent territories citizenGBD
    - National (overseas)GBN
    - Overseas citizenGBO
    - Protected PersonGBP
    - SubjectGBS
United Republic of TanzaniaTZA
United States of AmericaUSA
United States of America Minor Outlying IslandsUMI
UruguayURY
UzbekistanUZB
VanuatuVUT
VenezuelaVEN
Viet NamVNM
Virgin Islands (Great Britian)VGB
Virgin Islands (United States)VIR
Wallis and Futuna IslandsWLF
Western SaharaESH
YemenYEM
ZaireZAR
ZambiaZMB
ZimbabweZWE
United Nations Organization   (If indicating nationality, indicates an UN offical)UNO
United Nations   specialized agency officialUNA
Stateless (per Article 1 of 1954 convention)XXA
Refugee (per Article 1 of 1951 convention, amended by 1967 protocol)XXB
Refugee (non-convention)XXC
Unspecified / UnknownXXX

Contact webmaster - Copyright © 2004 (2004-01-31)

No comments: