KDE PIM/KItinerary/SNCF Barcodes: Difference between revisions

From KDE Community Wiki
 
(10 intermediate revisions by the same user not shown)
Line 4: Line 4:
== General Observations ==
== General Observations ==


* Aztec code
* Aztec code on SNCF tickets, PDF417 code on printed SNCF tickets
* found on SNCF PDF tickets
* fixed size, 132 ASCII characters
* fixed size, 132 ASCII characters
* can contain one or two legs
* can contain one or two legs
* has large similarities with what is described in "European Union Agency For Railways - Technical Document - Digital Security Elements For Rail Passenger Ticketing - TAP TSI TD B.12 - §8 ELB - Element List Barcode"


== Layout ==
== Layout ==
Line 40: Line 40:
| 110 || 1 || '1' or '2' || class first leg ||
| 110 || 1 || '1' or '2' || class first leg ||
|-
|-
| 111 || 4 || alpha-numeric || tariff/price code || can be blank, presumably for non-discounted tickets
| 111 || 4 || alpha-numeric || tariff/price code || can be blank, see below
|-
|-
| 115 || 1 || '0', '1' or '2' || class second leg || '0' if single leg
| 115 || 1 || '0', '1' or '2' || class second leg || '0' if single leg
Line 68: Line 68:
| 4 || 256 || binary || signature? || seems largely random
| 4 || 256 || binary || signature? || seems largely random
|-
|-
| 260 || 8 || '00T10087' || constant || 0087 is the UIC operator code of SNCF
| 260 || 4 || '00T1' || constant ||
|-
| 264 || 4 || number || UIC issuer or operator code || '0087' for SNCF
|-
|-
| 268 || 9 || numeric || ticket number ||
| 268 || 9 || number || ticket number ||
|-
|-
| 277 || 5 || SNCF station id || departure station ||
| 277 || 5 || SNCF station id || departure station ||
Line 76: Line 78:
| 282 || 5 || SNCF station id || arrival station ||
| 282 || 5 || SNCF station id || arrival station ||
|-
|-
| 287 || 5 || SNCF station id or blank || ??? ||
| 287 || 5 || SNCF station id or blank || via station ||
|-
|-
| 292 || 50 || blank || ||
| 292 || 50 || blank || ||
Line 86: Line 88:
| 351 || 1 || number || class? ||
| 351 || 1 || number || class? ||
|-
|-
| 352 || 4 || alpha-numeric || tariff/price code ||
| 352 || 4 || alpha-numeric || tariff/price code || see below
|-
|-
| 356 || 20 || free text? || tariff/price info? ||
| 356 || 20 || free text? || tariff/price info? ||
Line 121: Line 123:
* 174 bytes of a base64-like looking string, but apparently not valid base64
* 174 bytes of a base64-like looking string, but apparently not valid base64
* seems largely random even for closely adjacent tickets, so possibly encrypted or just a token?
* seems largely random even for closely adjacent tickets, so possibly encrypted or just a token?
= SNCF Normandie Tickets =
* Aztec code, 176-179 bytes of binary content
* Not byte aligned, big endian
* First part seems to be neither encrypted nor compressed, and seems to contain trip information.
* Second part has high entropy, suggesting a trailing signature as found in many ERA formats.
* Content part is not byte aligned, but otherwise seems to have no similarities with ERA SSB.
* Brute force search finds train number (14 bit) and TCN (32 bit), with slightly varying positions (starting at bit 443-467), with 31 bits between them. Suggests variable lengths elements in the content.
* Brute force search for ERA SSB-style 6 bit text encoding yields no results.
* Brute force search for unaligned 7 bit strings finds tariff code, UIC operator codes and the booking reference. Suggests ASN.1 IA5String in uPER encoding?
* The above also finds the constant string "FCB2" in all samples, which could indicate ERA FCB and which would confirm an ASN.1 uPER encoding. But can ERA FCB even occur outside of an UIC 918.3 container?
* Initial naive attempts to decode using the ERA FCB ASN.1 schema (https://www.era.europa.eu/sites/default/files/barcode.zip) yield no results, but this could still be some variation of the FCB schema, or have its own container format that would need to be unwrapped first.
= Carte Advantage =
== General Observations ==
* Aztec code, on a PDF
* vague similarities to the basic ticket barcode format
== Layout ==
{| class="wikitable"
! Offset !! Size !! Content Type !! Meaning !! Notes
|-
| 0 || 4 || 'h0FV' || ||
|-
| 5 || 15 || 15x'0'|| ||
|-
| 20 || 4 || '1111' || ||
|-
| 24 || 10 || 10x'0' || ||
|-
| 34 || 10 || dd'/'MM'/'yyyy || first day of validity || one day after of what's stated in the PDF!?
|-
| 44 || 10 || dd'/'MM'/'yyyy || last day of validity? || also observed with '31/12/2999', not matching the PDF claiming 1y validity
|-
| 53 || 17 || numeric || card number ||
|-
| 70 || 2 || blank || ||
|-
| 72 || 38 || 38x'X' || ||
|-
| 110 || 1 || '1' or '2' || class ||
|-
| 111 || 4 || alphanumeric || tariff/program code? ||
|-
| 115 || 10 || dd'/'MM'/'yyyy || ? || date with no correlation to anything in the PDF?
|}
= Tariff Codes =
Observed tariff codes in any of the ticket barcodes:
* CF00: "Ayant Droit Résa Payante", "Ayant Droit avec fichet" - 100% staff discount
* CF90: "Ayant Droit 90%", "Ayant Droit sans fichet" - 90% staff discount
* CJ11: "CARTE JEUNE"
* CW11: "CARTE AVANTAGE ADULTE"
* CW12: "NO FLEX CARTE AVANTAGE ADULTE"
* CW25: "CARTE AVANTAGE ADULTE"
* EF11: "CARTE ENFANT+" (parent)
* EF99: "CARTE ENFANT+" (child)
* IR00: "INTERRAIL CONTINGENTÉ 2ÈME CLASSE"
* IR01: "INTERRAIL NON CONTINGENTÉ 2ÈME CLASSE"
* JR11: occurs together with a loyalty program number in the PDF
* NU44: "Billet illico PROMO VACANCES 40%"
* NV30: "LIBERTIO’ JEUNES TRAIN JAUNE"
* NW26: "BILLET ILLICO LIBERTE SEMAINE 25%"
* PR11:
* PX01: "TARIF NORMAL RÉGIONAL"
* PX05: "DIGITAL TARIF"?
* SE11: "BILLET CARTE AVANTAGE SENIOR"
* SR50: "Carte Senior"
* <empty>: not operated by SNCF

Latest revision as of 15:52, 11 September 2023

SNCF Tickets

General Observations

  • Aztec code on SNCF tickets, PDF417 code on printed SNCF tickets
  • fixed size, 132 ASCII characters
  • can contain one or two legs
  • has large similarities with what is described in "European Union Agency For Railways - Technical Document - Digital Security Elements For Rail Passenger Ticketing - TAP TSI TD B.12 - §8 ELB - Element List Barcode"

Layout

Offset Size Content Type Meaning Notes
0 4 'i0CV' or 'i1CV' constant the second version so far only seen on paper tickets
4 6 alpha-numeric PNR
10 9 numeric document id / e-ticket number
19 4 '1211' constant
23 10 dd'/'MM'/'yyyy traveller birth date
33 5 SNCF station id departure station first leg
38 5 SNCF station id arrival station first leg
43 5 numeric train number first leg
48 5 dd'/'MM travel date
53 19 numeric cliend id
72 19 string traveler last name blank padded, uppercase, right aligned (PDF) or left aligned (paper tickets)
91 19 string travel first name blank padded, uppercase, right aligned (PDF) or left aligned (paper tickets)
110 1 '1' or '2' class first leg
111 4 alpha-numeric tariff/price code can be blank, see below
115 1 '0', '1' or '2' class second leg '0' if single leg
116 5 SNCF station id departure station second leg blank if single leg
121 5 SNCF station id arrival station second leg blank if single leg
126 5 numeric train number second leg '00000' if single leg

SNCF Secutix Tickets

General Observations

  • Aztec code
  • found on some SNCF PDF tickets and in the app
  • fixed size, 686 byte, mix of byte-aligned binary blob and ASCII content

Layout

Offset Size Content Type Meaning Notes
0 4 '2200' constant
4 256 binary signature? seems largely random
260 4 '00T1' constant
264 4 number UIC issuer or operator code '0087' for SNCF
268 9 number ticket number
277 5 SNCF station id departure station
282 5 SNCF station id arrival station
287 5 SNCF station id or blank via station
292 50 blank
342 1 'S' constant
343 8 ddMMyyyy travel date
351 1 number class?
352 4 alpha-numeric tariff/price code see below
356 20 free text? tariff/price info?
376 19 string traveler last name left aligned, blank padded, uppercase
395 19 string traveler first name light aligned, blank padded, uppercase
414 8 ddMMyyyy traveler birth date
422 10 'ADULTE' or 'ENFANTE' traveler type 1
432 2 number traveler type quantity 1 zero-padded
434 10 'ADULTE'/'ENFANTE' or blank traveler type 2 blank if not present
444 2 number traveler type quantity 2 zero-padded, '00' if not present
446 8 ddMMyyyy travel date? again?
454 8 ddMMyyyy travel date? again??
462 12 '0' constant
474 12 ddMMyyyyhhmm purchase date/time
486 10 number price zero-padded, in Cent
496 190 text free text? blank-padded, right aligned

Ouigo Tickets

  • 174 bytes of a base64-like looking string, but apparently not valid base64
  • seems largely random even for closely adjacent tickets, so possibly encrypted or just a token?

SNCF Normandie Tickets

  • Aztec code, 176-179 bytes of binary content
  • Not byte aligned, big endian
  • First part seems to be neither encrypted nor compressed, and seems to contain trip information.
  • Second part has high entropy, suggesting a trailing signature as found in many ERA formats.
  • Content part is not byte aligned, but otherwise seems to have no similarities with ERA SSB.
  • Brute force search finds train number (14 bit) and TCN (32 bit), with slightly varying positions (starting at bit 443-467), with 31 bits between them. Suggests variable lengths elements in the content.
  • Brute force search for ERA SSB-style 6 bit text encoding yields no results.
  • Brute force search for unaligned 7 bit strings finds tariff code, UIC operator codes and the booking reference. Suggests ASN.1 IA5String in uPER encoding?
  • The above also finds the constant string "FCB2" in all samples, which could indicate ERA FCB and which would confirm an ASN.1 uPER encoding. But can ERA FCB even occur outside of an UIC 918.3 container?
  • Initial naive attempts to decode using the ERA FCB ASN.1 schema (https://www.era.europa.eu/sites/default/files/barcode.zip) yield no results, but this could still be some variation of the FCB schema, or have its own container format that would need to be unwrapped first.

Carte Advantage

General Observations

  • Aztec code, on a PDF
  • vague similarities to the basic ticket barcode format

Layout

Offset Size Content Type Meaning Notes
0 4 'h0FV'
5 15 15x'0'
20 4 '1111'
24 10 10x'0'
34 10 dd'/'MM'/'yyyy first day of validity one day after of what's stated in the PDF!?
44 10 dd'/'MM'/'yyyy last day of validity? also observed with '31/12/2999', not matching the PDF claiming 1y validity
53 17 numeric card number
70 2 blank
72 38 38x'X'
110 1 '1' or '2' class
111 4 alphanumeric tariff/program code?
115 10 dd'/'MM'/'yyyy ? date with no correlation to anything in the PDF?

Tariff Codes

Observed tariff codes in any of the ticket barcodes:

  • CF00: "Ayant Droit Résa Payante", "Ayant Droit avec fichet" - 100% staff discount
  • CF90: "Ayant Droit 90%", "Ayant Droit sans fichet" - 90% staff discount
  • CJ11: "CARTE JEUNE"
  • CW11: "CARTE AVANTAGE ADULTE"
  • CW12: "NO FLEX CARTE AVANTAGE ADULTE"
  • CW25: "CARTE AVANTAGE ADULTE"
  • EF11: "CARTE ENFANT+" (parent)
  • EF99: "CARTE ENFANT+" (child)
  • IR00: "INTERRAIL CONTINGENTÉ 2ÈME CLASSE"
  • IR01: "INTERRAIL NON CONTINGENTÉ 2ÈME CLASSE"
  • JR11: occurs together with a loyalty program number in the PDF
  • NU44: "Billet illico PROMO VACANCES 40%"
  • NV30: "LIBERTIO’ JEUNES TRAIN JAUNE"
  • NW26: "BILLET ILLICO LIBERTE SEMAINE 25%"
  • PR11:
  • PX01: "TARIF NORMAL RÉGIONAL"
  • PX05: "DIGITAL TARIF"?
  • SE11: "BILLET CARTE AVANTAGE SENIOR"
  • SR50: "Carte Senior"
  • <empty>: not operated by SNCF