Chapter 31: Aztec Code in the Rail Industry |
Brief Summary |
The adoption of Aztec Code by European rail companies for mobile ticketing represents a pivotal moment in the digitisation of public transport. This two-dimensional symbology, with its high data density and robust error correction, has enabled a seamless transition from magnetic stripe tickets to secure, cryptographically signed digital tickets that can be displayed on a smartphone screen. This chapter explores how Aztec Code has transformed rail ticketing, examines the technical features that make it ideal for this application, and presents detailed real-world use cases from railway operators across Europe. Additionally, we will explore the role of Code 39---a foundational one-dimensional barcode---in the broader rail industry and other sectors, contrasting its characteristics with the advanced capabilities of Aztec Code. |

|
1. Introduction: The End of the Magnetic Stripe |
For decades, the magnetic stripe ticket was the backbone of rail fare collection. Its familiar black stripe on card stock held the encoded data for a passenger's journey. However, the magnetic stripe has inherent limitations. It is susceptible to wear and tear, demagnetisation, and physical damage. The data capacity is relatively small, and the infrastructure required to read and write these tickets---the magnetic readers and encoders---is costly to maintain. |
The rise of the smartphone presented an opportunity for rail operators to reduce costs, improve customer convenience, and unlock new data capabilities. The challenge was finding a technology that could replicate the speed of a magnetic stripe read while storing significantly more information and providing robust security against forgery. European rail companies found their answer in the Aztec Code. |
The transition was not merely about replacing a physical medium with a digital image; it was a fundamental shift in how ticketing data is structured, secured, and validated. An Aztec Code on a mobile ticket is a cryptographic envelope, capable of encoding passenger names, train numbers, seat assignments, and a secure digital signature that proves the ticket's authenticity without requiring constant connectivity to a central database. |

|
2. Understanding the Aztec Code |
Before delving into the rail applications, it is essential to understand the technical characteristics that make the Aztec Code uniquely suited for this environment. |
2.1. Origins and Naming |
The Aztec Code was invented in 1995 by Andrew Longacre, Jr. and Robert Hussey at Symbol Technologies. It was formally published by the Association for Automatic Identification and Mobility (AIM) two years later and became available for public use in 2008. The name derives from the distinctive central finder pattern, which resembles an Aztec pyramid when viewed from above. This pattern consists of concentric square rings that allow a scanner to quickly determine the code's orientation and size, even if it is rotated or skewed. |
2.2. Key Characteristics |
The Aztec Code offers a combination of features that surpass those of many other barcode symbologies, particularly for ticketing applications. |
High Data Density |
The Aztec Code is a matrix (2D) barcode that encodes data in a grid of square modules. Its ability to store large amounts of information in a very small physical space is one of its most significant advantages. The code can store up to 3,832 numeric characters, 3,067 alphabetic characters, or 1,914 bytes of binary data in a single symbol. For rail tickets, this capacity is sufficient to hold a passenger's name, journey details, fare information, and a cryptographic signature without requiring a large, cumbersome barcode. |
Lack of Quiet Zone Requirement |
Unlike many other barcodes that require a blank area (quiet zone) around the symbol to ensure accurate scanning, the Aztec Code does not need one. The central finder pattern is so effective that the scanner can locate the code even when it is printed close to other text or graphics. This allows for the creation of smaller, more aesthetically pleasing tickets and maximizes the use of screen real estate on mobile devices. |
Continuous Error Correction |
The Aztec Code uses Reed-Solomon error correction, a powerful algorithm that allows the symbol to be read even if part of it is damaged or obscured. One of its unique features is that the error correction level can be continuously tuned. This means that an application can choose an optimal balance between the amount of data stored and the level of fault tolerance. For rail tickets, a higher error correction level is often recommended to account for the physical wear of printed tickets or the display artifacts on a phone screen, such as glare or motion blur. |
2.3. The Digital Signature |
From a security perspective, the most critical feature of the Aztec Code for rail ticketing is its ability to carry a digital signature. When a ticket is issued, the operator creates a cryptographic signature using a private key and encodes it within the Aztec Code. When a ticket inspector or gate scanner reads the code, it uses a public key to verify that the signature is authentic. This process, known as asymmetric cryptography, ensures that the ticket cannot be forged, even if a malicious actor understands the data structure. The signature confirms that the ticket was issued by a legitimate authority and that the data contained within it has not been tampered with. |

|
3. Technical Drivers for Rail Adoption |
Several specific technical challenges in rail ticketing made the Aztec Code a superior choice over alternative symbologies like QR Code or older 1D barcodes like Code 39. |
3.1. Data Capacity |
A modern rail ticket is not just a seat reservation; it often includes a complex set of fare restrictions, route codes, and passenger details. Magnetic stripe tickets had very limited capacity. QR Codes can store a large volume of data, but the Aztec Code generally offers higher density for the same amount of alphanumeric data, resulting in a smaller printed symbol. |
3.2. Scanning in Challenging Conditions |
Validation of rail tickets occurs in various environments, from brightly lit stations to dimly lit train carriages. The scanner may be a fixed gate or a handheld device carried by a conductor on a moving train. According to the Swedish public transport ticketing infrastructure specification BoB, Aztec Code was chosen because it can be reliably scanned in difficult environments and performs well in transport environments with vibration and varying lighting conditions. |
3.3. Security |
As discussed, the ability to embed a cryptographic signature is crucial. In the UK, the RSP-6 standard mandates that the Aztec Code on a ticket is a 'cryptographically signed envelope'. This allows for offline validation, meaning that ticket inspectors do not need a constant network connection to a central server to verify a ticket's authenticity. The signature is mathematically verified on the device itself. |
3.4. Performance on Mobile Screens |
The transition to mobile tickets introduced new challenges. Scanning a code from a phone screen is different from scanning a printed paper ticket. Issues like screen glare, interference patterns (the screen's pixel grid), and motion blur from a moving phone can degrade the scan. The Aztec Code's high error correction tolerance and advanced image processing algorithms make it more resilient to these challenges than some older barcode types. Furthermore, standards like Sweden's BoB specify exact requirements for scaling Aztec codes on screens to ensure readability, recommending specific error correction levels and cautioning against disproportionate scaling that can cause distortions. |

|
4. Case Studies: Aztec Code in Action Across European Rail |
The adoption of Aztec Code for rail ticketing is widespread across Europe. While implementation specifics vary, the core use case remains consistent: encoding secure, machine-readable tickets for mobile and print-at-home passengers. |
4.1. Deutsche Bahn (Germany) |
Deutsche Bahn, the German national railway, was an early adopter of mobile ticketing using the Aztec Code. The tickets are generated in PDF format or displayed within the DB Navigator app and contain a square, high-density 2D barcode. This code encodes the ticket's core data, including the passenger name, route, train number, and fare class. |
Given the complexity of the German railway network and the concept of 'Lndertickets' (regional tickets) with complex validity rules, the encoded data is structured to allow validation systems to quickly parse the ticket's attributes. The cryptographic signature is essential for preventing forgery, though the exact signature verification mechanisms remain proprietary to Deutsche Bahn. |
4.2. The Swedish BoB Standard |
Sweden's public transport system has developed a sophisticated and well-documented standard for mobile ticketing known as 'BoB' (a Swedish acronym for 'digital ticket'). The BoB specification relies on the Aztec Code as the primary optical carrier of ticket data. |
The BoB standard defines a 'Mobile Ticket Bundle' (MTB), which is a structured data container that is compressed and encoded into the Aztec Code. The process involves: |
1. Signing: The ticket issuer signs the data using an Elliptic Curve Digital Signature Algorithm (specifically, EC P-256). |
2. Dynamic Signing: In some cases, the mobile app can also dynamically sign the ticket. This signature can be updated periodically, for example, every 10 seconds, adding an extra layer of security and preventing ticket sharing. |
3. Encoding: The signed and compressed data is then encoded into the Aztec Code. |
4. Validation: Onboard validation units read the code, verify both the issuer's signature and the dynamic signature, and validate the passenger's journey. |
The use of dynamic signing in Sweden is a testament to the flexibility and security that the Aztec Code enables, going beyond simple static data representation. |
4.3. Adoption Across Europe |
The adoption extends far beyond Germany and Sweden. A wide range of European rail operators have integrated Aztec Code into their mobile ticketing platforms, including: |
United Kingdom: Operators under the National Rail umbrella use Aztec Codes on e-tickets, following the RSP-6 standard. |
France: SNCF uses Aztec Codes on mobile and print-at-home tickets. |
Switzerland: Swiss Federal Railways (SBB) supports Aztec Code based mobile tickets. |
Italy: Trenitalia uses Aztec Codes for its mobile ticketing. |
Netherlands: Nederlandse Spoorwegen (NS) employs the technology. |
In Spain, the technology has been integrated into even more advanced systems, where an Aztec Code can serve as a second factor for biometric facial recognition access to departure lounges. At Malaga Maria Zambrano station, a 5G-enabled project demonstrated using facial recognition combined with an Aztec code for passenger access, doubling the security of the access control system. |

|
5. Code 39: The Veteran Workhorse |
To fully appreciate the innovation brought by the Aztec Code, it is helpful to examine the role of one-dimensional barcodes, particularly Code 39, in industry. While the Aztec Code is the star of modern rail ticketing, Code 39 has been a foundational workhorse in logistics, manufacturing, and government for decades. Comparing the two highlights why the rail industry needed to upgrade. |
5.1. The Origins of Code 39 |
Code 39, also known as Code 3 of 9, was developed by Intermec Corporation in 1974. It was the first barcode symbology that could encode not only digits but also uppercase letters and a few special characters. The '39' in its name refers to its structure: each character is represented by nine elements (five bars and four spaces), three of which are wide. This simple, robust design made it easy to print and scan, leading to its widespread adoption. |
5.2. Technical Characteristics |
Encoding Character Set |
The standard Code 39 encodes 43 characters: uppercase letters (A-Z), digits (0-9), and seven special characters (space, period, dash, slash, plus, percent, and dollar sign). An extended version ('Code 39 Extended') can encode the full ASCII character set (including lowercase letters) by using specific two-character combinations to represent each symbol. |
Self-Checking |
One of the key features of Code 39 is that it is self-checking. This means that if a single bar or space is misread, the scanner can detect the error because the code will not match the expected nine-element pattern. This self-checking capability means a check digit is not required, although one can be added for additional data integrity. |
Variable Length |
Code 39 is a variable-length symbology, meaning it can encode any amount of data. However, because it is a 1D code, the physical size of the barcode grows linearly with the amount of data. |

|
6. Code 39 in the Rail Industry and Beyond |
While Code 39 is not suited for the high-density, secure, digital ticketing applications that Aztec Code has conquered, it still finds significant use in the rail industry's supporting systems. |
6.1. Asset Tracking and Inventory Management |
Within a rail company, millions of components need to be tracked. From replacement wheelsets and brake pads to onboard catering supplies, Code 39 labels are ubiquitous. The Code 39 standard is robust and the print can be large, making it readable by staff using traditional handheld scanners even in harsh conditions like maintenance depots. The fact that Code 39 does not require a check digit makes it extremely simple to implement and process, which is an asset in fast-paced logistics environments where speed is more important than cryptographic security. |
6.2. Maintenance and Safety Inspections |
In many industries, including rail, aviation, and automotive, Code 39 is used for tracking the inspection history of critical parts. For example, a rail car's axle can be marked with a durable Code 39 barcode. A maintenance worker scans the code with a mobile device, bringing up its inspection history and allowing them to log a new inspection. The simplicity of the code and its compatibility with millions of off-the-shelf scanners make it a reliable choice for these 'rugged' applications. |
6.3. LOGMARS and Government Use |
The US military developed the LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) system to standardize asset tracking across the Department of Defense. LOGMARS relies heavily on Code 39. This military adoption further cemented Code 39's status as a durable and reliable industry standard. Rail operators with military or government contracts often inherit these standardization requirements. |
6.4. Warehouse Operations |
In rail warehouses and parts distribution centers, Code 39 is used to mark shelves, bins, and pallets. When a rail engineer orders a specific part, the warehouse staff scans the Code 39 barcode on the shelf to confirm they have picked the correct item. The low cost of implementing Code 39 and the wide availability of printing and scanning hardware make it a default choice for internal logistics. |

|
7. Why Code 39 Was Not Chosen for Mobile Ticketing |
Despite its widespread success in asset tracking, Code 39 is fundamentally unsuitable for modern consumer mobile ticketing. The reasons are precisely the strengths of the Aztec Code. |
7.1. Data Density |
Code 39 is a low-density symbology. This means it requires a large physical footprint to encode even a modest amount of data. A train ticket that contains a passenger name, train number, and secure signature would be enormous if printed as a Code 39. It would not fit on a standard ticket stock and would certainly not be scannable on a small mobile phone screen. In contrast, an Aztec code is 'approximately 30x smaller than Code 39 while encoding the same amount of data'. |
7.2. Lack of Mandatory Error Correction |
While Code 39 is self-checking to prevent misreads, it does not have built-in Reed-Solomon error correction. If a Code 39 barcode is physically damaged or dirty, it becomes unreadable. This lack of redundancy makes it a poor choice for tickets that will be handled, folded, or scanned from a reflective screen. |
7.3. Security |
Code 39 encodes data in plain text. While a check digit can be added, it offers no protection against forgery. Anyone with a barcode printer could generate a Code 39 barcode mimicking the data format of a ticket. The Aztec Code supports cryptographic signatures, turning the 2D image into a secure, unforgeable digital passport, which is a non-negotiable requirement for modern fare collection. |
7.4. Limited Character Set |
Standard Code 39 only supports uppercase letters and numbers. Encoding a passenger's name in lowercase requires using the 'Extended' version, which effectively doubles the length of the data, further reducing the already low density. In contrast, the Aztec Code can easily encode Unicode characters and binary data, making it globally applicable. |

|
8. The Future: Machine Vision and Beyond |
The rail industry's adoption of the Aztec Code is not just a story of replacing one technology with another; it is part of a broader shift toward 'Machine Vision' and AI-driven validation. We are moving away from simple scanning of a barcode to verifying a passenger's identity and travel rights using multiple data points. |
8.1. Biometric Integration |
The development at Malaga station, where an Aztec Code is used with a 5G-powered facial recognition system, is a look into the future. In this scenario, the passenger's face is the primary identifier, and the Aztec Code is a second factor that validates the specific ticket for that journey. This creates a 'contactless journey' where a passenger simply walks through a gate and their ticket is verified. The Aztec Code is well-suited for this because it is machine-readable at high speeds and can carry the necessary biometric token or linking data. |
8.2. Deterministic Validation |
The future of ticketing is 'deterministic validation.' This is the ability for the machine to know, with absolute mathematical certainty, whether a ticket is valid for a specific route at a specific time. As described in the UK's Rail Delivery Group standards, the Aztec Code is a 'cryptographically signed envelope' that allows for this deterministic validation offline. The validation engine does not need to check a server to see if the ticket is real; it uses the public key to verify the mathematical signature within the code itself. |
8.3. Unifying Ticketing Media |
The ultimate goal is to unify all forms of ticketing media---physical paper, smartcards, and mobile phones---under a single architecture. This would allow passengers to seamlessly switch between media and allow operators to validate all tickets with the same high level of security. As the rail industry moves toward Great British Railways and similar unified structures in other countries, the Aztec Code represents the logical and secure standard for carrying the 'machine truth' of a passenger's journey. |

|
9. Detailed Summary |
Aztec Code: The Engine of Modern Rail Ticketing |
The Aztec Code is the critical enabler of the modern digital rail ticket. Its adoption by a vast number of European rail operators---including Deutsche Bahn, SNCF, SBB, Trenitalia, and the UK's National Rail---is grounded in specific, technical advantages that align perfectly with the needs of the 21st-century passenger: |
1. High Data Density and Compactness: The Aztec Code can store thousands of characters of passenger, journey, and fare data in a small physical space. This is essential for printing on tickets and displaying on mobile phone screens where real estate is precious. The lack of a required quiet zone allows for maximized efficiency. |
2. Superior Error Correction: The continuous error correction functionality, often recommended at 23% for public transport, ensures tickets are readable despite physical wear, damage, or the visual artifacts of screen display (like glare or pixelation). This reduces friction at gates and makes the customer experience more reliable. |
3. Cryptographic Security: The ability to act as a 'cryptographically signed envelope' is perhaps the most important feature for the rail industry. By allowing the digital signing of the ticket data with an asymmetric key pair, the Aztec Code enables offline, deterministic validation. It ensures the ticket cannot be forged and that the data cannot be tampered with, protecting revenue and operational integrity. |
4. Performance in Challenging Environments: Standards like Sweden's BoB have explicitly validated that the Aztec Code performs well in transport environments, accommodating vibration, motion blur, and varying lighting conditions. This reliability is vital for onboard inspections. |
Code 39: The Legacy Workhorse |
In stark contrast, Code 39 is a foundational, older one-dimensional symbology whose characteristics have shaped it for a different set of tasks. |
1. Low Data Density: Code 39's structure (five bars and four spaces, three of which are wide) results in a very low data density. Encoding the same data as an Aztec Code requires a physically massive symbol, making it impractical for consumer ticketing but acceptable for large industrial labels. |
2. Simplicity and Robustness: Code 39 is self-checking and does not require a check digit, making it easy to generate, print, and scan. Its simplicity has led to its use in rugged environments, such as military logistics (LOGMARS), warehouse inventory, and asset tracking within maintenance depots. |
3. Lack of Built-in Security: Code 39 does not support advanced cryptography or error correction. A Code 39 label is easily damaged and cannot be digitally signed. This makes it entirely unsuitable for use as a secure, unforgeable consumer ticket. |

|
The Symbiotic Relationship |
The rail industry uses both symbologies, but for complementary purposes. The Aztec Code is the face of the passenger, handling the crucial, customer-facing data of fare collection and journey validation. It is the tool for the digital age, managing security and data density. Code 39 operates behind the scenes, managing the physical assets, maintenance schedules, and internal supply chain. As the rail industry evolves toward unified, machine-verified, and biometric-enabled travel, the Aztec Code will continue to be the foundational technology, while Code 39 will remain a testament to the durability of a simple, well-implemented engineering solution. |