summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-11-23 09:59:31 +0100
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-11-23 09:59:31 +0100
commitecdc5505218d71ba365ff729f11a1b504a71c986 (patch)
tree1e963c4308b870545fcea28cdc7c028f9e0c067f /src/main/java/org/uic
parentbug fixes on dynamic frame (diff)
downloadUIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar.gz
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar.bz2
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar.lz
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar.xz
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.tar.zst
UIC-barcode-ecdc5505218d71ba365ff729f11a1b504a71c986.zip
Diffstat (limited to 'src/main/java/org/uic')
-rw-r--r--src/main/java/org/uic/barcode/Decoder.java2
-rw-r--r--src/main/java/org/uic/barcode/Encoder.java8
-rw-r--r--src/main/java/org/uic/barcode/dynamicFrame/Constants.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn151
4 files changed, 10 insertions, 152 deletions
diff --git a/src/main/java/org/uic/barcode/Decoder.java b/src/main/java/org/uic/barcode/Decoder.java
index 09ee839..9f102d3 100644
--- a/src/main/java/org/uic/barcode/Decoder.java
+++ b/src/main/java/org/uic/barcode/Decoder.java
@@ -172,6 +172,8 @@ public class Decoder {
uicTicket = uicTicketCoder.decodeFromAsn(level1Content.getByteData(), 1);
} else if (level1Content.getFormat().equals("FCB2")) {
uicTicket = uicTicketCoder.decodeFromAsn(level1Content.getByteData(), 2);
+ } else if (level1Content.getFormat().equals("FCB3")) {
+ uicTicket = uicTicketCoder.decodeFromAsn(level1Content.getByteData(), 3);
}
}
diff --git a/src/main/java/org/uic/barcode/Encoder.java b/src/main/java/org/uic/barcode/Encoder.java
index e906881..9463548 100644
--- a/src/main/java/org/uic/barcode/Encoder.java
+++ b/src/main/java/org/uic/barcode/Encoder.java
@@ -100,7 +100,13 @@ public class Encoder {
DataType ticketData = new DataType();
UicRailTicketCoder uicTicketCoder = new UicRailTicketCoder();
- ticketData.setFormat(Constants.DATA_TYPE_FCB_VERSION_1);
+ if (fcbVersion == 1) {
+ ticketData.setFormat(Constants.DATA_TYPE_FCB_VERSION_1);
+ } else if (fcbVersion == 2) {
+ ticketData.setFormat(Constants.DATA_TYPE_FCB_VERSION_2);
+ } else if (fcbVersion == 3) {
+ ticketData.setFormat(Constants.DATA_TYPE_FCB_VERSION_3);
+ }
ticketData.setData(new OctetString(uicTicketCoder.encode(ticket, fcbVersion)));
dynamicFrame.getLevel2SignedData().getLevel1Data().getData().add(ticketData);
diff --git a/src/main/java/org/uic/barcode/dynamicFrame/Constants.java b/src/main/java/org/uic/barcode/dynamicFrame/Constants.java
index 774475a..8f47986 100644
--- a/src/main/java/org/uic/barcode/dynamicFrame/Constants.java
+++ b/src/main/java/org/uic/barcode/dynamicFrame/Constants.java
@@ -16,6 +16,7 @@ public class Constants {
public static String DATA_TYPE_FCB_VERSION_1 = "FCB1";
public static String DATA_TYPE_FCB_VERSION_2 = "FCB2";
+ public static String DATA_TYPE_FCB_VERSION_3 = "FCB3";
public static String DYNAMIC_BARCODE_FORMAT_DEFAULT = "U1";
diff --git a/src/main/java/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn b/src/main/java/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn
deleted file mode 100644
index 2999d18..0000000
--- a/src/main/java/org/uic/barcode/ticket/api/spec/uicBarcodeHeader0.1.asn
+++ /dev/null
@@ -1,151 +0,0 @@
--- Creator: ASN.1 Editor (http://asneditor.sourceforge.net)
--- Author: ClemensGantert
--- Created: Tue Aug 11 11:40:28 CEST 2015
-ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-
--- imports and exports
--- EXPORTS ALL;
-
-
--- ##############################################################################################
--- #
--- # UIC barcode header - first draft
--- #
--- ##############################################################################################
-
-
--- ##############################################################################################
--- #
--- # Naming and encoding conventions
--- #
--- # Elements included as String and as Numeric values:
--- # Some elements are included in different formats to reduce the data size.
--- # These elements must be included only once.
--- # These elements are named with the same name and appendix
--- # Num (numeric values)
--- # IA5 (String values according to ASN IA5String (7Bit))
--- #
--- # RICS codes must be used to encode companies (issuer, product owner, ...) where available
--- # other codes are possible based on bilateral agreements
--- # the format is kept more flexible to cover upcoming extensions of the RICS code by ERA
--- #
--- # Stations can be coded using the UIC and upcoming ERA code lists. Proprietary codes are
--- # possible based on bilateral agreements. Format: 1..9999999 or alphanumeric without
--- # special character (IA5String)
--- #
--- #
--- # ! INTEGERS must not exceed the value of 9,223,372,036,854,775,807 (64 bit) even in case
--- # ! they are unrestricted!!!
--- # !
--- # ! Some elements like ReferenceNum or cardIdNum are defined as an unrestricted integer.
--- # ! Unlike other numerical values the cardIdNum and referenceNum can be larger than a usual 32 bit Integer
--- # ! Some ASN.1 implementation tools are limited to 32 bit integers which is too small.
--- # ! Please ensure to use a tool capable of dealing with larger numbers.
--- #
--- # BOOLEAN is always non optional
--- #
--- # Encoding of time:
--- # time is encoded as the number of minutes of the day 0 = 00:00, 1440 = 24:00,
--- # time data elements end with "time" in their name
--- #
--- # Encoding of date:
--- # .........................................................................................................
--- # The issuing date is given in UTC, but some other date values are given in local time where the exact time zone is not known.
--- #
--- #
--- #
--- # ASN.1 Extensions:
--- #
--- # The specification makes use of extension (",...").
--- # These extesions might be defined in future versions of the UIC specification
--- # Implementations must support the extension feature of ASN.1, at least they must be able to ignore extensions while decoding the data
--- # ASN.1 extensions will be defined by UIC. It is not allowed to define bilateral extensions.
--- #
--- # Bilateral Extensions:
--- # Bilateral extensions can be included in the data element "ExtensionData".
--- #
--- #
--- #
--- #########################################################################################
-
-
--- ############################################################################################
-
-
--- type assignments
-
- -- #########################################################################################
- -- the basic entry point of the data structure
- -- the data include:
- -- -issuer informations
- -- -the details of the transport document
- -- -informations required for the control process
- -- -informations on the travelers independent from the transport document
- -- -proprietary extensions
- --
- -- ##########################################################################################
- UicBarcodeHeader ::= SEQUENCE {
- -- format type
- format IA5String,
- -- "UIC" = UIC ticket
-
- version Integer (1..16),
-
- -- provider of the signature (RICS code)
- securityProviderNum INTEGER (1..32000) OPTIONAL,
- securityProviderIA5 IA5String OPTIONAL,
-
-
- staticData SEQUENCE OF DataType,
- staticSignature SignatureType OPTIONAL,
-
-
-
- -- additional dynamic data i.e. phone number, IMEI, timestamp , .... --> To be defined separately
- dynamicDataFormat IA5String OPTIONAL,
- dynamicData OCTET STRING OPTIONAL,
- dynamicPublicKey OCTET STRING OPTIONAL,
- dynamicSignature SignatureType OPTIONAL
-
- -- proprietary data defined bilaterally
- extension SEQUENCE OF ExtensionData OPTIONAL
- ,...
-
- }
-
- DataType ::= SEQUENCE {
- staticDataFormat IA5String DEFAULT "FCB1",
- -- FCB1 FCB version 1
- -- 1080XYZ
- staticData OCTET STRING
- }
-
-
-
- SignatureType ::= SEQUENCE {
- signingAlg IA5String,
- keyId IA5String (SIZE(1..5)),
- signature OCTET STRING,
- }
-
-
-
- -- ###########################################################################################
- -- generic non standard extension element
- -- the generic non - standard element contains:
- -- - an extension id to distinguish different extensions
- -- - the extension data as binary data
- -- proprietary extensions are by definition proprietary. This standard provides
- -- the means to identify these extensions
- -- within the data and to skip these data.
- -- the evaluation of these data and the unique identification of the extensions
- -- via the extension id is in the
- -- responsibility of the railways which use these extensions.
- -- ###########################################################################################
- ExtensionData ::= SEQUENCE {
- extensionId IA5String,
- extensionData OCTET STRING
- }
-
-
-END \ No newline at end of file