summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 14:39:47 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 14:39:47 +0200
commita7515e3c057ef00ade3ae093b179c2787f07803b (patch)
treeec36c0520415879268db1ca0d57f132eca1d7876
parentCreate README.md (diff)
downloadUIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar.gz
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar.bz2
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar.lz
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar.xz
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.tar.zst
UIC-barcode-a7515e3c057ef00ade3ae093b179c2787f07803b.zip
Diffstat (limited to '')
-rw-r--r--.classpath11
-rw-r--r--.gitignore1
-rw-r--r--.project23
-rw-r--r--.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--src/net/gcdc/asn1/datatypes/CharacterRestriction.java3
-rw-r--r--src/net/gcdc/asn1/test/UperEncodeObjectIdentifierTest.java73
-rw-r--r--src/net/gcdc/asn1/uper/ObjectIdentifierCoder.java175
-rw-r--r--src/net/gcdc/asn1/uper/StringCoder.java47
-rw-r--r--src/org/uic/header/DataBlockType.java110
-rw-r--r--src/org/uic/header/DataType.java66
-rw-r--r--src/org/uic/header/DynamicHeader.java204
-rw-r--r--src/org/uic/header/Extension.java72
-rw-r--r--src/org/uic/header/SequenceOfDataType.java26
-rw-r--r--src/org/uic/header/SignedDataType.java58
15 files changed, 885 insertions, 3 deletions
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..0e44ae2
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="owner.project.facets" value="java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/.project b/.project
new file mode 100644
index 0000000..b10a462
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>UIC-barcode</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c59d0c6
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,15 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..017b6f4
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/src/net/gcdc/asn1/datatypes/CharacterRestriction.java b/src/net/gcdc/asn1/datatypes/CharacterRestriction.java
index ac40e25..608a9fc 100644
--- a/src/net/gcdc/asn1/datatypes/CharacterRestriction.java
+++ b/src/net/gcdc/asn1/datatypes/CharacterRestriction.java
@@ -8,5 +8,6 @@ public enum CharacterRestriction {
IA5String,
BMPString,
UniversalString,
- UTF8String;
+ UTF8String,
+ ObjectIdentifier;
}
diff --git a/src/net/gcdc/asn1/test/UperEncodeObjectIdentifierTest.java b/src/net/gcdc/asn1/test/UperEncodeObjectIdentifierTest.java
new file mode 100644
index 0000000..c46751d
--- /dev/null
+++ b/src/net/gcdc/asn1/test/UperEncodeObjectIdentifierTest.java
@@ -0,0 +1,73 @@
+package net.gcdc.asn1.test;
+
+import static org.junit.Assert.assertEquals;
+import java.util.logging.Level;
+
+import org.junit.jupiter.api.Test;
+
+import net.gcdc.asn1.datatypes.Asn1Optional;
+import net.gcdc.asn1.datatypes.CharacterRestriction;
+import net.gcdc.asn1.datatypes.RestrictedString;
+import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.uper.UperEncoder;
+
+class UperEncodeObjectIdentifierTest {
+
+
+ /**
+ * Example from the Standard on UPER.
+ <pre>
+ TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
+ value1 OBJECT IDENTIFIER,
+ value2 OBJECT IDENTIFIER,
+ value3 OBJECT IDENTIFIER
+ }
+
+ value TestRecord ::= {
+ value1 2.16.840.1.101.3.4.3.1,
+ value2 2.16.840.1.101.3.4.3.2,
+ value3 1.2.840.10045.3.1.7
+ }
+ </pre>
+ */
+
+ @Sequence
+ public static class TestRecord {
+
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value1 = "2.16.840.1.101.3.4.3.1"; //DSA SHA224
+
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value2 = "2.16.840.1.101.3.4.3.2"; //DSA SHA248
+
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ String value3 = "1.2.840.10045.3.1.7"; //ECC
+
+ public TestRecord() {}
+
+ }
+
+ @Test
+ public void testEncode() throws IllegalArgumentException, IllegalAccessException {
+ TestRecord record = new TestRecord();
+ byte[] encoded = UperEncoder.encode(record);
+ String hex = UperEncoder.hexStringFromBytes(encoded);
+ UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
+ assertEquals("0960864801650304030109608648016503040302082A8648CE3D030107",hex);
+ }
+
+ @Test
+ public void testDecode() throws IllegalArgumentException, IllegalAccessException {
+ TestRecord record = new TestRecord();
+ byte[] encoded = UperEncoder.encode(record);
+ String hex = UperEncoder.hexStringFromBytes(encoded);
+ UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
+ assertEquals("0960864801650304030109608648016503040302082A8648CE3D030107",hex);
+ TestRecord result = UperEncoder.decode(encoded, TestRecord.class);
+ assertEquals(result.value1,record.value1);
+ assertEquals(result.value2,record.value2);
+ assertEquals(result.value3,record.value3);
+ }
+
+
+}
diff --git a/src/net/gcdc/asn1/uper/ObjectIdentifierCoder.java b/src/net/gcdc/asn1/uper/ObjectIdentifierCoder.java
new file mode 100644
index 0000000..a7a7e5e
--- /dev/null
+++ b/src/net/gcdc/asn1/uper/ObjectIdentifierCoder.java
@@ -0,0 +1,175 @@
+package net.gcdc.asn1.uper;
+
+import java.io.ByteArrayOutputStream;
+import java.math.BigInteger;
+
+public class ObjectIdentifierCoder {
+
+
+/*
+ OID encoding for dummies :) :
+
+ each OID component is encoded to one or more bytes (octets)
+
+ OID encoding is just a concatenation of these OID component encodings
+
+ first two components are encoded in a special way (see below)
+
+ if OID component binary value has less than 7 bits, the encoding is just a single octet,
+ holding the component value (note, most significant bit, leftmost, will always be 0)
+ otherwise, if it has 8 and more bits, the value is "spread" into multiple octets - split the
+ binary representation into 7 bit chunks (from right), left-pad the first one with zeroes if needed,
+ and form octets from these septets by adding most significant (left) bit 1, except from the last
+ chunk, which will have bit 0 there.
+
+ first two components (X.Y) are encoded like it is a single component with a value 40*X + Y
+
+ This is a rewording of ITU-T recommendation X.690, chapter 8.19
+
+*/
+
+ /*
+ *
+The first octet has value 40 * value1 + value2. (This is unambiguous, since value1 is limited to values 0, 1, and 2; value2 is limited to the range 0 to 39 when value1 is 0 or 1; and, according to X.208, n is always at least 2.)
+
+The following octets, if any, encode value3, ..., valuen.
+Each value is encoded base 128, most significant digit first, with as few digits as possible, and the most significant bit of each octet except the last in the value's encoding set to "1."
+
+Example: The first octet of the BER encoding of RSA Data Security, Inc.'s object identifier is 40 * 1 + 2 = 42 = 2a16. The encoding of 840 = 6 * 128 + 4816 is 86 48 and the encoding of 113549 = 6 * 1282 + 7716 * 128 + d16 is 86 f7 0d. This leads to the following BER encoding:
+
+06 06 2a 86 48 86 f7 0d
+ */
+
+ private static final Long LONG_LIMIT = (Long.MAX_VALUE >> 7) - 0x7f;
+
+
+ /*
+ * adaptation of the bouncy castle implementation available at bouncy castle under APACHE 2.0 license
+ */
+ public static String decodeObjectId(byte[] bytes) {
+
+ StringBuffer objId = new StringBuffer();
+ long value = 0;
+ BigInteger bigValue = null;
+ boolean first = true;
+
+ for (int i = 0; i != bytes.length; i++) {
+
+ int b = bytes[i] & 0xff;
+
+ if (value <= LONG_LIMIT) {
+ value += (b & 0x7f);
+ if ((b & 0x80) == 0) { // end of number reached
+
+ if (first) {
+ if (value < 40) {
+ objId.append('0');
+ } else if (value < 80) {
+ objId.append('1');
+ value -= 40;
+ } else {
+ objId.append('2');
+ value -= 80;
+ }
+ first = false;
+ }
+
+ objId.append('.');
+ objId.append(value);
+ value = 0;
+ } else {
+ value <<= 7;
+ }
+ } else {
+ if (bigValue == null) {
+ bigValue = BigInteger.valueOf(value);
+ }
+ bigValue = bigValue.or(BigInteger.valueOf(b & 0x7f));
+ if ((b & 0x80) == 0) {
+ if (first) {
+ objId.append('2');
+ bigValue = bigValue.subtract(BigInteger.valueOf(80));
+ first = false;
+ }
+ objId.append('.');
+ objId.append(bigValue);
+ bigValue = null;
+ value = 0;
+ } else {
+ bigValue = bigValue.shiftLeft(7);
+ }
+ }
+ }
+
+ return objId.toString();
+
+ }
+
+
+ public static byte[] encodeObjectId(String oids) {
+
+ String[] components = oids.split("\\.");
+
+ if (components.length < 2) throw new AssertionError("Object Identifier Format error (" + oids + ")");
+
+ try {
+ int first = Integer.parseInt(components[0]) * 40;
+
+ ByteArrayOutputStream aOut = new ByteArrayOutputStream();
+
+
+ if (components[1].length() <= 18) {
+ writeField(aOut, first + Long.parseLong(components[1]));
+ } else {
+ writeField(aOut, new BigInteger(components[1]).add(BigInteger.valueOf(first)));
+ }
+
+ for (int i = 2; i < components.length; i++) {
+
+ if (components[i].length() <= 18) {
+ writeField(aOut, Long.parseLong(components[i]));
+ } else {
+ writeField(aOut, new BigInteger(components[i]));
+ }
+ }
+
+ return aOut.toByteArray();
+
+ } catch (NumberFormatException e) {
+ throw new AssertionError("Object Identifier Format error (" + oids + ")");
+ }
+ }
+
+
+ private static void writeField(ByteArrayOutputStream out, long fieldValue)
+ {
+ byte[] result = new byte[9];
+ int pos = 8;
+ result[pos] = (byte)((int)fieldValue & 0x7f);
+ while (fieldValue >= (1L << 7)) {
+ fieldValue >>= 7;
+ result[--pos] = (byte)((int)fieldValue & 0x7f | 0x80);
+ }
+ out.write(result, pos, 9 - pos);
+ }
+
+ private static void writeField(ByteArrayOutputStream out, BigInteger fieldValue)
+ {
+ int byteCount = (fieldValue.bitLength() + 6) / 7;
+ if (byteCount == 0) {
+ out.write(0);
+ } else {
+ BigInteger tmpValue = fieldValue;
+ byte[] tmp = new byte[byteCount];
+ for (int i = byteCount - 1; i >= 0; i--) {
+ tmp[i] = (byte)((tmpValue.intValue() & 0x7f) | 0x80);
+ tmpValue = tmpValue.shiftRight(7);
+ }
+ tmp[byteCount - 1] &= 0x7f;
+ out.write(tmp, 0, tmp.length);
+ }
+ }
+
+
+
+}
diff --git a/src/net/gcdc/asn1/uper/StringCoder.java b/src/net/gcdc/asn1/uper/StringCoder.java
index d42238b..33a9df6 100644
--- a/src/net/gcdc/asn1/uper/StringCoder.java
+++ b/src/net/gcdc/asn1/uper/StringCoder.java
@@ -53,7 +53,37 @@ class StringCoder implements Decoder, Encoder {
.length())) { throw new IllegalArgumentException(
"Bad string length, expected " + sizeRange.minValue() + ".."
+ sizeRange.maxValue() + ", got " + string.length()); }
- if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) {
+
+ if (restrictionAnnotation.value() == CharacterRestriction.ObjectIdentifier) {
+
+ byte[] oidb = ObjectIdentifierCoder.encodeObjectId(string);
+
+ BitBuffer stringbuffer = ByteBitBuffer.createInfinite();
+
+ for (byte b: oidb){
+ UperEncoder.encodeConstrainedInt(stringbuffer, b & 0xff, 0, 255);
+ }
+ //-for (char c : string.toCharArray()) {
+ //- encodeChar(stringbuffer, c, restrictionAnnotation);
+ //-}
+ //char array replaced - end
+
+ stringbuffer.flip();
+ if (stringbuffer.limit() % 8 != 0) {
+ throw new AssertionError("encoding resulted not in multiple of 8 bits");
+ }
+ int numOctets = (stringbuffer.limit() + 7) / 8; // Actually +7 is not needed here,
+ // since we already checked with %8.
+ int position1 = bitbuffer.position();
+ UperEncoder.encodeLengthDeterminant(bitbuffer, numOctets);
+ UperEncoder.logger.debug(String.format("ObjectIdentifier %s, length %d octets, encoded as %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position1)));
+ int position2 = bitbuffer.position();
+ for (int i = 0; i < stringbuffer.limit(); i++) {
+ bitbuffer.put(stringbuffer.get());
+ }
+ UperEncoder.logger.debug(String.format("UTF8String %s, encoded length %d octets, value bits: %s", string, numOctets, bitbuffer.toBooleanStringFromPosition(position2)));
+ return;
+ } else if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) {
// UTF8 length
BitBuffer stringbuffer = ByteBitBuffer.createInfinite();
@@ -129,7 +159,20 @@ class StringCoder implements Decoder, Encoder {
throw new UnsupportedOperationException(
"Unrestricted character strings are not supported yet. All annotations: " + Arrays.asList(classOfT.getAnnotations()));
}
- if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) {
+ if (restrictionAnnotation.value() == CharacterRestriction.ObjectIdentifier) {
+ //decode object identifier
+ Long numOctets = UperEncoder.decodeLengthDeterminant(bitbuffer);
+ List<Boolean> content = new ArrayList<Boolean>();
+ for (int i = 0; i < numOctets * 8; i++) {
+ content.add(bitbuffer.get());
+ }
+ byte[] contentBytes = UperEncoder.bytesFromCollection(content);
+ UperEncoder.logger.debug(String.format("Content bytes (hex): %s", UperEncoder.hexStringFromBytes(contentBytes)));
+ String resultStr = ObjectIdentifierCoder.decodeObjectId(contentBytes);
+ UperEncoder.logger.debug(String.format("Object Identifier: %s", resultStr));
+ T result = UperEncoder.instantiate(classOfT, resultStr);
+ return result;
+ } else if (restrictionAnnotation.value() == CharacterRestriction.UTF8String) {
Long numOctets = UperEncoder.decodeLengthDeterminant(bitbuffer);
List<Boolean> content = new ArrayList<Boolean>();
for (int i = 0; i < numOctets * 8; i++) {
diff --git a/src/org/uic/header/DataBlockType.java b/src/org/uic/header/DataBlockType.java
new file mode 100644
index 0000000..ce4084f
--- /dev/null
+++ b/src/org/uic/header/DataBlockType.java
@@ -0,0 +1,110 @@
+package org.uic.header;
+
+import net.gcdc.asn1.datatypes.Asn1Optional;
+import net.gcdc.asn1.datatypes.CharacterRestriction;
+import net.gcdc.asn1.datatypes.IntRange;
+import net.gcdc.asn1.datatypes.RestrictedString;
+import net.gcdc.asn1.datatypes.Sequence;
+
+/**
+ * The Class DataBlockType.
+ */
+@Sequence
+public class DataBlockType {
+
+
+ /** The data. */
+ public SequenceOfDataType data;
+
+ /**
+ * The signing algorithm
+ * Object Identifier of the Algorithm
+ * Number notation:
+ *
+ * e.g.:
+ * -- DSA SHA224 2.16.840.1.101.3.4.3.1
+ * -- DSA SHA248 2.16.840.1.101.3.4.3.2
+ * -- ECC 1.2.840.10045.3.1.7
+ *
+ *
+ */
+ @RestrictedString(CharacterRestriction.ObjectIdentifier)
+ @Asn1Optional public String signingAlg;
+
+ /** The key id. */
+ @IntRange(minValue=1,maxValue=1024)
+ @Asn1Optional public Long keyId;
+
+ /**
+ * Gets the data.
+ *
+ * @return the data
+ */
+ public SequenceOfDataType getData() {
+ return data;
+ }
+
+ /**
+ * Sets the data.
+ *
+ * @param data the new data
+ */
+ public void setData(SequenceOfDataType data) {
+ this.data = data;
+ }
+
+ /**
+ * Gets the signing algorithm
+ *
+ * Object Identifier of algorithm Algorithm
+ * Number notation:
+ *
+ * e.g.:
+ * -- DSA SHA224 2.16.840.1.101.3.4.3.1
+ * -- DSA SHA248 2.16.840.1.101.3.4.3.2
+ * -- ECC 1.2.840.10045.3.1.7
+ *
+ * @return the signing alg
+ */
+ public String getSigningAlg() {
+ return signingAlg;
+ }
+
+ /**
+ * Sets the signing algorithm
+ *
+ * Object Identifier of the Algorithm
+ * Number notation:
+ *
+ * e.g.:
+ * -- DSA SHA224 2.16.840.1.101.3.4.3.1
+ * -- DSA SHA248 2.16.840.1.101.3.4.3.2
+ * -- ECC 1.2.840.10045.3.1.7
+ *
+ * @param signingAlg the new signing algorithm
+ */
+ public void setSigningAlg(String signingAlgorithm) {
+ this.signingAlg = signingAlgorithm;
+ }
+
+ /**
+ * Gets the key id.
+ *
+ * @return the key id
+ */
+ public Long getKeyId() {
+ return keyId;
+ }
+
+ /**
+ * Sets the key id.
+ *
+ * @param keyId the new key id
+ */
+ public void setKeyId(Long keyId) {
+ this.keyId = keyId;
+ }
+
+
+
+}
diff --git a/src/org/uic/header/DataType.java b/src/org/uic/header/DataType.java
new file mode 100644
index 0000000..8d453a3
--- /dev/null
+++ b/src/org/uic/header/DataType.java
@@ -0,0 +1,66 @@
+package org.uic.header;
+
+import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.datatypesimpl.OctetString;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class DataType.
+ */
+@Sequence
+public class DataType {
+
+ /*
+ * -- format:
+ -- FCB1 FCB version 1
+ -- RICS company code + addon
+ */
+
+ /** The data format.
+ *
+ * -- FCB1 FCB version 1
+ * -- FCB2 FCB version 2
+ * -- RICS company code + ...
+ * */
+ public String format;
+
+ /** The data. */
+ public OctetString data;
+
+ /**
+ * Gets the data format.
+ *
+ * @return the data format
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets the data format.
+ *
+ * @param dataFormat the new data format
+ */
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets the data.
+ *
+ * @return the data
+ */
+ public OctetString getData() {
+ return data;
+ }
+
+ /**
+ * Sets the data.
+ *
+ * @param data the new data
+ */
+ public void setData(OctetString data) {
+ this.data = data;
+ }
+
+}
diff --git a/src/org/uic/header/DynamicHeader.java b/src/org/uic/header/DynamicHeader.java
new file mode 100644
index 0000000..05e06eb
--- /dev/null
+++ b/src/org/uic/header/DynamicHeader.java
@@ -0,0 +1,204 @@
+package org.uic.header;
+
+import net.gcdc.asn1.datatypes.Asn1Optional;
+import net.gcdc.asn1.datatypes.CharacterRestriction;
+import net.gcdc.asn1.datatypes.HasExtensionMarker;
+import net.gcdc.asn1.datatypes.IntRange;
+import net.gcdc.asn1.datatypes.RestrictedString;
+import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.datatypesimpl.OctetString;
+
+
+/**
+ * The DynamicHeader for bar codes
+ *
+ * Implementation of the Draft under discussion, not final
+ *
+ */
+@Sequence
+@HasExtensionMarker
+public class DynamicHeader {
+
+
+ /** The format. */
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String format;
+
+ /** The vesion. */
+ @IntRange(minValue=1,maxValue=16)
+ public Long version;
+
+
+ /**
+ * The security provider
+ * numeric codes 1 ...32000
+ *
+ * */
+ @IntRange(minValue=1,maxValue=32000)
+ @Asn1Optional public Long securityProviderNum;
+
+ /** The security provider
+ * alphanumeric codes
+ */
+ @RestrictedString(CharacterRestriction.IA5String)
+ @Asn1Optional public String securityProviderIA5;
+
+
+ /** The static data. */
+ public SignedDataType staticData;
+
+ /** The dynamic data. */
+ @Asn1Optional public SignedDataType dynamicData;
+
+ /** The dynamic public key. */
+ @Asn1Optional public OctetString dynamicPublicKey;
+
+ /** The extension. */
+ @Asn1Optional public Extension extension;
+
+ /**
+ * Gets the format.
+ *
+ * @return the format
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets the format.
+ *
+ * @param format the new format
+ */
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public Long getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param vesion the new version
+ */
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
+ /**
+ * Gets the security provider num.
+ *
+ * @return the security provider num
+ */
+ public Long getSecurityProviderNum() {
+ return securityProviderNum;
+ }
+
+ /**
+ * Sets the security provider num.
+ *
+ * @param securityProviderNum the new security provider num
+ */
+ public void setSecurityProviderNum(Long securityProviderNum) {
+ this.securityProviderNum = securityProviderNum;
+ }
+
+ /**
+ * Gets the security provider IA 5.
+ *
+ * @return the security provider IA 5
+ */
+ public String getSecurityProviderIA5() {
+ return securityProviderIA5;
+ }
+
+ /**
+ * Sets the security provider IA 5.
+ *
+ * @param securityProviderIA5 the new security provider IA 5
+ */
+ public void setSecurityProviderIA5(String securityProviderIA5) {
+ this.securityProviderIA5 = securityProviderIA5;
+ }
+
+ /**
+ * Gets the static data.
+ *
+ * @return the static data
+ */
+ public SignedDataType getStaticData() {
+ return staticData;
+ }
+
+ /**
+ * Sets the static data.
+ *
+ * @param staticData the new static data
+ */
+ public void setStaticData(SignedDataType staticData) {
+ this.staticData = staticData;
+ }
+
+ /**
+ * Gets the dynamic data.
+ *
+ * @return the dynamic data
+ */
+ public SignedDataType getDynamicData() {
+ return dynamicData;
+ }
+
+ /**
+ * Sets the dynamic data.
+ *
+ * @param dynamicData the new dynamic data
+ */
+ public void setDynamicData(SignedDataType dynamicData) {
+ this.dynamicData = dynamicData;
+ }
+
+ /**
+ * Gets the dynamic public key.
+ *
+ * @return the dynamic public key
+ */
+ public OctetString getDynamicPublicKey() {
+ return dynamicPublicKey;
+ }
+
+ /**
+ * Sets the dynamic public key.
+ *
+ * @param dynamicPublicKey the new dynamic public key
+ */
+ public void setDynamicPublicKey(OctetString dynamicPublicKey) {
+ this.dynamicPublicKey = dynamicPublicKey;
+ }
+
+ /**
+ * Gets the extension.
+ *
+ * @return the extension
+ */
+ public Extension getExtension() {
+ return extension;
+ }
+
+ /**
+ * Sets the extension.
+ *
+ * @param extension the new extension
+ */
+ public void setExtension(Extension extension) {
+ this.extension = extension;
+ }
+
+
+}
diff --git a/src/org/uic/header/Extension.java b/src/org/uic/header/Extension.java
new file mode 100644
index 0000000..98f44d7
--- /dev/null
+++ b/src/org/uic/header/Extension.java
@@ -0,0 +1,72 @@
+package org.uic.header;
+
+
+import net.gcdc.asn1.datatypes.CharacterRestriction;
+import net.gcdc.asn1.datatypes.RestrictedString;
+import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.datatypesimpl.OctetString;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Extension.
+ */
+@Sequence
+public class Extension extends Object {
+
+ /**
+ * Instantiates a new extension.
+ */
+ public Extension() {}
+
+ /** The extension id. */
+ @RestrictedString(CharacterRestriction.IA5String)
+ public String extensionId;
+
+ /** The extension data. */
+ public OctetString extensionData;
+
+ /**
+ * Gets the extension id.
+ *
+ * @return the extension id
+ */
+ public String getExtensionId() {
+
+ return this.extensionId;
+ }
+
+ /**
+ * Gets the extension data.
+ *
+ * @return the extension data
+ */
+ public byte[] getExtensionData() {
+
+ return extensionData.toByteArray();
+ }
+
+ /**
+ * Sets the extension id.
+ *
+ * @param extensionId the new extension id
+ */
+ public void setExtensionId(String extensionId) {
+
+ this.extensionId = extensionId;
+ }
+
+ /**
+ * Sets the extension data.
+ *
+ * @param extensionData the new extension data
+ */
+ public void setExtensionData(byte[] extensionData) {
+
+ this.extensionData = new OctetString(extensionData);
+
+ }
+
+
+
+}
diff --git a/src/org/uic/header/SequenceOfDataType.java b/src/org/uic/header/SequenceOfDataType.java
new file mode 100644
index 0000000..c91b8fa
--- /dev/null
+++ b/src/org/uic/header/SequenceOfDataType.java
@@ -0,0 +1,26 @@
+package org.uic.header;
+
+
+import java.util.Collection;
+
+import net.gcdc.asn1.datatypes.Asn1SequenceOf;
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class SequenceOfDataType.
+ */
+public class SequenceOfDataType extends Asn1SequenceOf<DataType>{
+
+ /**
+ * Instantiates a new sequence of data type.
+ */
+ public SequenceOfDataType() { super(); }
+
+ /**
+ * Instantiates a new sequence of data type.
+ *
+ * @param coll the coll
+ */
+ public SequenceOfDataType(Collection<DataType> coll) { super(coll); }
+
+}
diff --git a/src/org/uic/header/SignedDataType.java b/src/org/uic/header/SignedDataType.java
new file mode 100644
index 0000000..1cbaa8e
--- /dev/null
+++ b/src/org/uic/header/SignedDataType.java
@@ -0,0 +1,58 @@
+package org.uic.header;
+
+import net.gcdc.asn1.datatypes.Asn1Optional;
+import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.datatypesimpl.OctetString;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SignedDataType.
+ */
+@Sequence
+public class SignedDataType {
+
+ /** The data. */
+ public DataBlockType data;
+
+ /** The signature. */
+ @Asn1Optional public OctetString signature;
+
+ /**
+ * Gets the data.
+ *
+ * @return the data
+ */
+ public DataBlockType getData() {
+ return data;
+ }
+
+ /**
+ * Sets the data.
+ *
+ * @param data the new data
+ */
+ public void setData(DataBlockType data) {
+ this.data = data;
+ }
+
+ /**
+ * Gets the signature.
+ *
+ * @return the signature
+ */
+ public OctetString getSignature() {
+ return signature;
+ }
+
+ /**
+ * Sets the signature.
+ *
+ * @param signature the new signature
+ */
+ public void setSignature(OctetString signature) {
+ this.signature = signature;
+ }
+
+
+
+}