-
Notifications
You must be signed in to change notification settings - Fork 9
HowTo encode a bar code with Static Frame
CGantert345 edited this page Jan 4, 2024
·
8 revisions
Two ticket data formats are supported:
TLB Ticket Layout Barcode - a format description for text describing the ticket to be displayed FCB Flexible Content Barcode - a structured ticket data format
TicketLayout layout = new TicketLayout();
// add your content to the ticket layout
IUicRailTicket ticket = new SimpleUicRailTicket();
// add your content to the FBC ticket description
2. Create an Encoder and add the ticket data and/or ticket layout data and the version of the frame and the version of the FCB ticket data
Encoder encoder = new Encoder(ticket, layout, Encoder.UIC_BARCODE_TYPE_CLASSIC, <frame version>, <FCB version>);
Add proprietary data to the static frame
ArrayList<DataRecord> dataRecords = encoder.getStaticFrame().getDataRecords();
dataRecords.add(<myProprietaryDataRecord>)
encoder.setStaticHeaderParams(<ticketId>, <Language>);
The data can be signed. The Provider of the signature algorithm can be provided to use a dedicated provider for the signature. If no provider is indicated the first provider that might be able to the signature algorithm is used. There needs to be a provider registered which can handle the signature.
encoder.signLevel1(<SecurityProvider RICS code>, keyPair.getPrivate(), <algorithm OID>, <keyId>, <provider>);
deprecated
encoder.signLevel1(<SecurityProvider RICS code>, keyPair.getPrivate(), <algorithm OID>, <keyId>);
byte[] encoded = encoder.encode();