Mrz

class Mrz(documentNumber: String, documentNumberCheckDigit: Char, dateOfBirth: String, dateOfBirthCheckDigit: Char, dateOfExpiry: String, dateOfExpiryCheckDigit: Char) : ChipAccessKey

A key from the MRZ: the document number, the date of birth and the date of expiry, each with its check digit.

Give each value exactly as it is printed in the MRZ, fillers (<) included, and the check digits as printed, even when one does not match its field: the chip was set up with the printed values, and the SDK never corrects them. From a parsed or scanned MRZ use Companion.from; when a person types the values in, use Companion.fromTypedFields, which works out the check digits.

Every value may hold only the MRZ characters A to Z, 0 to 9 and <.

The document number is always the complete number (Doc 9303 Part 11, section 9.7.3). On a TD1 or TD2 document whose number is longer than nine characters, the number field holds only its first nine, the check-digit place holds a filler (<), and the rest of the number and its check digit sit at the start of the optional data. Give such a number whole, with its real check digit, or let fromPrintedFields join it from the printed fields.

Since

1.0.0

Parameters

documentNumber

The complete document number as printed, at least one character: the nine-character field with its fillers, or a longer number joined from the optional data.

documentNumberCheckDigit

The check digit of the document number, as printed.

dateOfBirth

The date of birth as printed, six characters (YYMMDD).

dateOfBirthCheckDigit

The check digit printed after the date of birth.

dateOfExpiry

The date of expiry as printed, six characters (YYMMDD).

dateOfExpiryCheckDigit

The check digit printed after the date of expiry.

Throws

when a value is empty, has the wrong length, or holds a character outside the MRZ characters, or when documentNumberCheckDigit is <: that filler marks a number that goes on in the optional data, so the number given is not complete. The message names the parameter, never the value.

Constructors

Link copied to clipboard
constructor(documentNumber: String, documentNumberCheckDigit: Char, dateOfBirth: String, dateOfBirthCheckDigit: Char, dateOfExpiry: String, dateOfExpiryCheckDigit: Char)

Types

Link copied to clipboard
object Companion

Builds an MRZ key from the fields as printed.

Properties

Link copied to clipboard

The fields whose printed check digit does not match the digit computed from the field (ICAO Doc 9303 Part 3, section 4.9): any of MrzField.DOCUMENT_NUMBER, MrzField.DATE_OF_BIRTH and MrzField.DATE_OF_EXPIRY; empty when all three match.

Link copied to clipboard

true after clear: the key can no longer open a chip.

Functions

Link copied to clipboard
fun clear()

Overwrites the stored values with zeros. A cleared key can no longer open a chip.

Link copied to clipboard
open override fun toString(): String

ChipAccessKey.Mrz, without the values.