From b17ce13cc31abd088088bf8ab26cc924a6a36585 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Tue, 28 Jul 2020 17:57:25 +0200 Subject: Draft of the new DOSIPAS included --- src/org/uic/header/DataBlockType.java | 129 -------------- src/org/uic/header/DataType.java | 67 -------- src/org/uic/header/DynamicHeader.java | 259 ----------------------------- src/org/uic/header/Extension.java | 72 -------- src/org/uic/header/SequenceOfDataType.java | 26 --- src/org/uic/header/SignedDataType.java | 67 -------- 6 files changed, 620 deletions(-) delete mode 100644 src/org/uic/header/DataBlockType.java delete mode 100644 src/org/uic/header/DataType.java delete mode 100644 src/org/uic/header/DynamicHeader.java delete mode 100644 src/org/uic/header/Extension.java delete mode 100644 src/org/uic/header/SequenceOfDataType.java delete mode 100644 src/org/uic/header/SignedDataType.java (limited to 'src/org/uic/header') diff --git a/src/org/uic/header/DataBlockType.java b/src/org/uic/header/DataBlockType.java deleted file mode 100644 index 503c203..0000000 --- a/src/org/uic/header/DataBlockType.java +++ /dev/null @@ -1,129 +0,0 @@ -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; -import net.gcdc.asn1.uper.UperEncoder; - - -/** - * The DataBlockType. - * - * Data block ready for signing - * - */ -@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 signingAlgorithm the new signing alg - */ - 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; - } - - - /** - * Gets the data for signature. - * - * The byte array containing the ASN.1 PER UNALIGNED encoded data of the DataBlock - * - * - * @return the data for signature - */ - public byte[] getDataForSignature() { - return UperEncoder.encode(this); - - } - - - -} diff --git a/src/org/uic/header/DataType.java b/src/org/uic/header/DataType.java deleted file mode 100644 index d4e15f7..0000000 --- a/src/org/uic/header/DataType.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.uic.header; - -import net.gcdc.asn1.datatypes.Asn1Default; -import net.gcdc.asn1.datatypes.Sequence; -import net.gcdc.asn1.datatypesimpl.OctetString; - -/** - * 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 + ... - **/ - @Asn1Default("FCB1") - 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 deleted file mode 100644 index 220e7f2..0000000 --- a/src/org/uic/header/DynamicHeader.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.uic.header; - -import org.uic.ticket.api.EncodingFormatException; -import org.uic.ticket.api.utils.UicEncoderUtils; - -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; -import net.gcdc.asn1.uper.UperEncoder; - - -// TODO: Auto-generated Javadoc -/** - * 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 version 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. - * - * in case the security provider code is encoded in IA5 this will return null - * - * @param securityProviderNum the new security provider num - */ - public void setSecurityProviderNum(Long securityProviderNum) { - this.securityProviderNum = securityProviderNum; - } - - /** - * Gets the security provider IA5. - * - * in case the security provider code is encoded numerically this will return null - * - * @return the security provider IA5 - */ - public String getSecurityProviderIA5() { - return securityProviderIA5; - } - - /** - * Sets the security provider - * - * The security provider code must use the IA5 Alphabet . - * - * @param securityProvider the new security provider - * @throws EncodingFormatException the encoding format exception - */ - public void setSecurityProvider(String securityProvider) throws EncodingFormatException { - this.securityProviderNum = UicEncoderUtils.getNum(securityProvider); - this.securityProviderIA5 = UicEncoderUtils.getIA5NonNum(securityProvider); - } - - - /** - * Gets the security provider. - * - * @return the security provider - */ - public String getSecurityProvider() { - return UicEncoderUtils.mapToString(this.securityProviderNum, this.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; - } - - - /** - * Encode. - * - * Encode the header as ASN.1 PER UNALIGNED byte array - * - * @return the byte[] - */ - public byte[] encode() { - return UperEncoder.encode(this); - } - - /** - * Decode. - * - * Decode the header from an ASN.1 PER UNALIGNED encoded byte array - * - * @param bytes the bytes - * @return the dynamic header - */ - public static DynamicHeader decode(byte[] bytes) { - return UperEncoder.decode(bytes, DynamicHeader.class); - } - - - -} diff --git a/src/org/uic/header/Extension.java b/src/org/uic/header/Extension.java deleted file mode 100644 index 98f44d7..0000000 --- a/src/org/uic/header/Extension.java +++ /dev/null @@ -1,72 +0,0 @@ -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 deleted file mode 100644 index c91b8fa..0000000 --- a/src/org/uic/header/SequenceOfDataType.java +++ /dev/null @@ -1,26 +0,0 @@ -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{ - - /** - * Instantiates a new sequence of data type. - */ - public SequenceOfDataType() { super(); } - - /** - * Instantiates a new sequence of data type. - * - * @param coll the coll - */ - public SequenceOfDataType(Collection coll) { super(coll); } - -} diff --git a/src/org/uic/header/SignedDataType.java b/src/org/uic/header/SignedDataType.java deleted file mode 100644 index 2cd2acd..0000000 --- a/src/org/uic/header/SignedDataType.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.uic.header; - -import net.gcdc.asn1.datatypes.Asn1Optional; -import net.gcdc.asn1.datatypes.Sequence; -import net.gcdc.asn1.datatypesimpl.OctetString; - -/** - * The Class SignedDataType. - */ -@Sequence -public class SignedDataType { - - /** The data. */ - public DataBlockType dataBlock; - - /** The signature. */ - @Asn1Optional public OctetString signature; - - /** - * Gets the data. - * - * @return the data - */ - public DataBlockType getDataBlock() { - return dataBlock; - } - - /** - * Sets the data. - * - * @param data the new data - */ - public void setDataBlock(DataBlockType dataBlock) { - this.dataBlock = dataBlock; - } - - /** - * Gets the signature. - * - * @return the signature - */ - public OctetString getSignature() { - return signature; - } - - /** - * Sets the signature. - * - * @param signature the signature - */ - public void setSignature(OctetString signature) { - this.signature = signature; - } - - - /** - * Sets the signature. - * - * @param signature the signature - */ - public void setSignature(byte[] signature) { - this.signature = new OctetString(signature); - } - - - -} -- cgit v1.2.3