French 2D-Doc
Overview
The parser supports the French 2D-Doc (ANTS) data format. The header zone (version, certification and certificate authority, issue and signature dates, document type, perimeter, country) and the data zone (values keyed by their two-character data identifiers) are parsed into structured fields, and the trailing Base32 signature is decoded and exposed as a hexadecimal string.
Note
Cryptographic verification of the signature against the ANTS trust list is not performed; the parser only decodes and extracts the document contents.
Sample usage
val parser = Parser.forFormat(dataCaptureContext, ParserDataFormat.FRENCH_2D_DOC)
val parsedData = parser.parseString(scannedString)
Example
A “Justificatif de domicile” (document type 00) is parsed into a header object,
one entry per data identifier, the decoded signature, the signedData span the
signature is computed over, and the full completeMessage:
[
{
"name": "header",
"parsed": {
"version": 3,
"certificationAuthorityId": "FR00",
"certificateId": "0001",
"documentIssueDate": "2012-10-15",
"documentSignatureDate": "2015-07-27",
"documentType": "00",
"perimeter": 1,
"country": "FR"
}
},
{ "name": "10", "parsed": "MLLE/SAMPLE/ANGELA" },
{ "name": "24", "parsed": "57000" },
{ "name": "25", "parsed": "METZ" },
{ "name": "26", "parsed": "FR" },
{
"name": "signature",
"parsed": "d9d28c3f6e0278b465b0b8a796360f9cfa2d5d02990bca193b68c9a1599f3a5c..."
},
{
"name": "signedData",
"parsed": "DC03FR000001123F16360001...<GS>"
},
{
"name": "completeMessage",
"parsed": "DC03FR000001123F16360001...<GS><US>3HJIYP3OAJ4LIZNQ..."
}
]
signedData is the header plus the data zone — everything up to the <US> separator,
i.e. the exact bytes the signature is computed over — and completeMessage is the full
received code (signedData followed by <US> and the Base32 signature). Above,
<GS>/<US> denote the ASCII group/unit separators and the raw values are truncated (...).