Deprecation warning

Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.

We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.

You'll find the updated documentation at: Data Capture SDK Documentation for Android

MRTD

Overview

The parser supports all versions of Machine Readable Travel Documents (MRTD) specified by the International Civil Aviation Organization (ICAO).

The ICAO specifies four types of MRTDs:

In addition, the parser supports the following non-ICAO standards:

Regex patterns

Use the following regex pattern to filter out MRTD codes:

Type

Regex

TD1 Regex Pattern

(I|C|A).[A-Z0<]{3}[A-Z0-9]{1,9}<?[0-9O]{1}[A-Z0-9<]{14,22}\n[0-9O]{7}(M|F|<)[0-9O]{7}[A-Z0<]{3}[A-Z0-9<]{11}[0-9O]\n([A-Z0]+<)+<([A-Z0]+<)+<+

TD2 Regex Pattern

[A-Z0]{1,2}<?[A-Z0<]{3}([A-Z0]+<)+<([A-Z0]+<)+<+\n[A-Z0-9]{1,9}.*[A-Z0<]{3}[0-9O]{7}(M|F|<)[0-9O]{7}[A-Z0-9<]*

TD2 French Regex Pattern

I.FRA[A-Z0<]+[0-9O<]{6}\n[0-9O]{4}[A-Z0-9]{3}[0-9O]{6}[A-Z0]+<?<?[A-Z0]*<*[0-9O]{7}(M|F|<).

TD3 Regex Pattern

P.[A-Z0<]{3}([A-Z0]+<)+<([A-Z0]+<)+<+\n[A-Z0-9]{1,9}<?[0-9O]{1}[A-Z0<]{3}[0-9]{7}(M|F|<)[0-9O]{7}[A-Z0-9<]+

MRV_A/MRV_B Regex Pattern

V<[A-Z<]{3}([A-Z0]+<)+<([A-Z0]+<)+<+\n[A-Z0-9]{1,9}<?[0-9O]{1}[A-Z0<]{3}[0-9O]{7}(M|F|<)[0-9O]{7}[A-Z0-9<]+

Swiss Driving License Regex Pattern

[A-Z0-9]{3}[0-9O]{3}(D|F|I|R)<<\n[A-Z0]{1,2}<?(CHE|LIE)[0-9O]{12}<<[0-9O]{6}<*\n([A-Z0]+<)+<([A-Z0]+<)+<+

ICAO MRTDs

Example

Parsing the following code (without quotes, source: 2015 ICAO Doc 9303, Specifications for TD1 Sized MRTDs, https://www.icao.int)

"I<UTOD231458907<<<<<<<<<<<<<<<\n7408122F1204159UTO<<<<<<<<<<<6\nERIKSSON<<ANNA<MARIA<<<<<<<<<<"

will result in the following JSON output:

[
   {
          "name" : "documentType",
          "parsed" : "td1",
          "rawString" : ""
   },
   {
          "name" : "documentCode",
          "parsed" : "I",
          "rawString" : "I<"
   },
   {
          "name" : "issuingState",
          "parsed" : "UTO",
          "rawString" : "UTO"
   },
   {
          "name" : "documentNumber",
          "parsed" : "D23145890",
          "rawString" : "D23145890"
   },
   {
          "name" : "optional",
          "parsed" : "",
          "rawString" : "<<<<<<<<<<<<<<<"
   },
   {
          "name" : "birthDate",
          "parsed" : {
                 "day" : 12,
                 "month" : 8,
                 "year" : 74
          },
          "rawString" : "740812"
   },
   {
          "name" : "sex",
          "parsed" : "female",
          "rawString" : "F"
   },
   {
          "name" : "expiryDate",
          "parsed" : {
                 "day" : 15,
                 "month" : 4,
                 "year" : 12
          },
          "rawString" : "120415"
   },
   {
          "name" : "nationality",
          "parsed" : "UTO",
          "rawString" : "UTO"
   },
   {
          "name" : "optional1",
          "parsed" : "",
          "rawString" : "<<<<<<<<<<<"
   },
   {
          "name" : "name",
          "parsed" : {
                 "primary" : [ "ERIKSSON" ],
                 "secondary" : [ "ANNA", "MARIA" ],
                 "truncated" : false
          },
          "rawString" : "ERIKSSON<<ANNA<MARIA<<<<<<<<<<"
   },
   {
          "name" : "metadata",
          "parsed" : {
                 "checksumValidation" : {
                        "birthDate" : true,
                        "compositeChecksum" : true,
                        "documentNumber" : true,
                        "expiryDate" : true
                 }
          },
          "rawString" : ""
   }
]

Common fields

The four types of MRTDs specified by the ICAO share most of the fields encoded in the Machine Readable Zone (MRZ) of the travel document.

The following fields are exposed for all ICAO MRTDs:

Data Element ID

Meaning

Parsed Content

documentType

Document Type

One of the following values:

  • ‘td1’,

  • ‘td2’,

  • ‘td3/mrp’,

  • ‘mrv’

documentCode

Document Type Code

One of the following values:

  • ‘P(passport type id)’,

  • ‘ID’,

  • ‘FA’

documentNumber

Document Number / Passport Number

String with the following interpretation:

  • TD1 & TD2: uniquely identifies the document from all other MROTDs issued by the State or organization.

  • TD3/MRP: Passport number

  • MRV: Either the passport number or the visa number, at the discretion of the issuing State.

expiryDate

Date of expiry

Dictionary with these key/value pairs:

  • ‘year’ : YY,

  • ‘month’: MM,

  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

issuingState

Issuing State

Three-letter string specified in ICAO document 9303-3.

name

Name

Dictionary with these key/value pairs:

  • ‘primary’: [primary identifiers, e.g., surname]

  • ‘secondary’: [secondary identifiers, e.g., given name or titles]

  • ‘truncated’: boolean

birthDate

Date of birth

Dictionary with these key/value pairs:

  • ‘year’ : YY,

  • ‘month’: MM,

  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

sex

Sex

One of the following values:

  • ‘female’

  • ‘male’

  • ‘nonspecified’

nationality

Nationality

Three-letter string specified in ICAO document 9303-3.

optional

Optional Data

For use of the issuing State or organization.

Please refer to the following sections for deviations from the the above table.

TD3 fields

  • ‘optional’: Usually employed to store the document holder’s personal number.

MRV fields

  • ‘documentNumber’: At the discretion of the issuing State, either the passport number or the visa number shall be used in this field.

  • ‘expiryDate’: In most cases this will be the date of expiry of the MRV and indicates the last day on which the visa can be used to seek entry. For some States this will be the date by or on which the holder should have left.

MRTD extensions

TD2/FrenchID fields

The French ID format is different then other ICAO formats in Common and does not contain all information described in the common fields section. For clarity, there is a complete example of TD2/FrenchID format.

Parsing the following code:

"IDFRABOITON<<<<<<<<<<<<<<<<<<<382020\n1203382018024PIERRE<<EMMANU8712068M5\n"

will result in the following JSON output:

[
    {
        "name" : "documentCode",
        "parsed" : "ID",
        "rawString" : "ID"
    },
    {
        "name" : "issuingCountry",
        "parsed" : "FRA",
        "rawString" : "FRA"
    },
    {
        "name" : "lastName",
        "parsed" : {
        "lastName" : "BOITON",
        "truncated" : false
        },
        "rawString" : "BOITON<<<<<<<<<<<<<<<<<<<"
    },
    {
        "name" : "officeOfIssuance",
        "parsed" : 20,
        "rawString" : "020"
    },
    {
        "name" : "dateOfIssuance",
        "parsed" : {
            "month" : 3,
            "year" : 12
        },
        "rawString" : "1203"
    },
    {
        "name" : "departmentOfIssuance",
        "parsed" : "382",
        "rawString" : "382"
    },
    {
        "name" : "managementCenterSign",
        "parsed" : 1802,
        "rawString" : "01802"
    },
    {
        "name" : "firstNames",
        "parsed" : {
            "firstNames" : [ "PIERRE", "EMMANU" ],
            "truncated" : true
        },
        "rawString" : "PIERRE<<EMMANU"
    },
    {
        "name" : "birthDate",
        "parsed" : {
            "day" : 6,
            "month" : 12,
            "year" : 87
        },
        "rawString" : "871206"
    },
    {
        "name" : "sex",
        "parsed" : "male",
        "rawString" : "M"
    },
    {
        "name" : "documentType",
        "parsed" : "td2/frenchID",
        "rawString" : ""
    },
    {
        "name" : "metadata",
        "parsed" : {
        "checksumValidation" : {
            "birthDate" : true,
            "compositeChecksum" : true,
            "issuanceInformation" : true
            }
        },
        "rawString" : ""
    }
]

The following fields are exposed for TD2/FrenchID:

Data Element ID

Meaning

Parsed Content

documentType

Document Type

Always has string ‘td2/frenchID’.

documentCode

Document Type Code

Always has string ‘ID’.

issuingCountry

Issuing Country

Always has string ‘FRA’.

lastName

Last name / Surname

Dictionary with these key/value pairs:

  • ‘lastName’: [Last name or surname of ID card owner]

  • ‘truncated’: boolean

officeOfIssuance

Office of issuance

Integer that encodes the office of issuance.

documentNumber

Document Number

String that encodes the document number.

dateOfIssuance

Date of issuance

Dictionary with these key/value pairs:

  • ‘year’ : YY,

  • ‘month’: MM

with YY, MM as integers.

departmentOfIssuance

Department Of issuance

String that encodes the department of issuance.

managementCenterSign

Management Center Sign

Integer assigned by the Management Center in chronological order in relation to the place of issue and the date of application.

firstNames

First name and given names

Dictionary with these key/value pairs:

  • ‘firstNames’: [First name followed by given names separated]

  • ‘truncated’: boolean

birthDate

Date of birth

Dictionary with these key/value pairs:

  • ‘year’ : YY,

  • ‘month’: MM,

  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

sex

Sex

One of the following values:

  • ‘female’

  • ‘male’

  • ‘nonspecified’

Swiss Driving License fields

The Swiss driving license format differs from the other MRTD formats. For example, no check digit is included in the data. For clarity, there is a complete example of this format.

Parsing the following code:

"AKU735D<<\nFACHE000231268003<<530727<<<<<\nAELLEN<<ROLAND<JOHN<<<<<<<<<<<\n"

will result in the following JSON output:

[
    {
        "name": "documentNumber",
        "parsed": "AKU735",
        "rawString": "AKU735"
    },
    {
        "name": "languageCode",
        "parsed": "D",
        "rawString" : "D"
    },
    {
        "name": "documentCode",
        "parsed": "FA",
        "rawString" : "FA"
    },
    {
        "name": "issuingState",
        "parsed": "CHE",
        "rawString" : "CHE"
    },
    {
        "name": "pinCode",
        "parsed": "000231268",
        "rawString" : "000231268"
    },
    {
        "name": "versionNumber",
        "parsed": "003",
        "rawString" : "003"
    },
    {
        "name": "birthDate",
        "parsed": {
            "year": 53,
            "month": 7,
            "day": 27
        },
        "rawString" : "530727"
    },
    {
        "name": "name",
        "parsed": {
            "primary": [
                "AELLEN"
            ],
            "secondary": [
                "ROLAND",
                "JOHN"
            ]
        },
        "rawString" : "AELLEN<<ROLAND<JOHN<<<<<<<<<<<"
    },
    {
        "name": "documentType",
        "parsed": "swissDL",
        "rawString": ""
    },
    {
        "name" : "metadata",
        "parsed" : {
            "checksumValidation" : null
        },
        "rawString" : ""
    }
]

The following fields are exposed for Swiss Driving License format:

Data Element ID

Meaning

Parsed Content

documentType

Document Type

Always has string ‘swissDL’.

documentCode

Document Type Code

Raw Card Number.

languageCode

Language Code

‘D’/’F’/’I’/’R’.

issuingState

Issuing State

‘CHE’/’LIE’.

pinCode

PIN Code

9 digit number.

numberVersion

Number Version

3 digit number.

birthDate

Date of birth

Dictionary with these key/value pairs:

  • ‘year’ : YY,

  • ‘month’: MM,

  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

name

Surnames and names

Dictionary with these key/value pairs:

  • ‘primary’: [surnames]

  • ‘secondary’: [names]

Parser Options

The parser can be configured by providing a JSON string containing key / value pairs. The following configuration options are available:

Key

Value Type

Description

relaxedChecksumValidation

Boolean

Enabling this option prevents the parser from failing for invalid checksums. Checksum verification results for the parsed fields are indicated using the ‘metadata’ field.

Metadata

The metadata field provides more information about the parsing of the input’s fields. The dictionary encoded in the JSON string of the ‘parsed’ field contains the following entries:

Key

Value Type

Description

checksumValidation

Dictionary

This dictionary contains a key / value entry for every check digit in the input document with the following properties:

  • key: Name of the field associated with the check digit.

  • value: Boolean indicating the success status of the checksum verification.