From 9c27db0284c86583c135282e637f5e4dcb220c89 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Wed, 12 May 2021 14:00:22 +0200 Subject: - Bug fix StaticHeader date format - Dynamic content for the dynamic content of the dynamic frame --- .../barcode/dynamicContent/fdc1/ExtensionData.java | 59 ++++++ .../fdc1/GeoCoordinateSystemType.java | 57 ++++++ .../dynamicContent/fdc1/GeoCoordinateType.java | 144 +++++++++++++++ .../barcode/dynamicContent/fdc1/GeoUnitType.java | 65 +++++++ .../fdc1/HemisphereLatitudeType.java | 56 ++++++ .../fdc1/HemisphereLongitudeType.java | 55 ++++++ .../dynamicContent/fdc1/SequenceOfExtension.java | 11 ++ .../uic/barcode/dynamicContent/fdc1/TimeStamp.java | 144 +++++++++++++++ .../fdc1/UicDynamicContentDataFDC1.java | 205 +++++++++++++++++++++ 9 files changed, 796 insertions(+) create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/ExtensionData.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateSystemType.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateType.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoUnitType.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLatitudeType.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLongitudeType.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/SequenceOfExtension.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/TimeStamp.java create mode 100644 src/main/java/org/uic/barcode/dynamicContent/fdc1/UicDynamicContentDataFDC1.java (limited to 'src/main/java/org/uic/barcode/dynamicContent/fdc1') diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/ExtensionData.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/ExtensionData.java new file mode 100644 index 0000000..52b76d1 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/ExtensionData.java @@ -0,0 +1,59 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.datatypesimpl.OctetString; + + +@Sequence +public class ExtensionData extends Object { + public ExtensionData() { + } + + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + public String extensionId; + + @FieldOrder(order = 1) + public OctetString extensionData; + + public String getExtensionId() { + return this.extensionId; + } + + public byte[] getExtensionData() { + return extensionData.toByteArray(); + } + + public void setExtensionId(String extensionId) { + this.extensionId = extensionId; + } + + public void setExtensionData(byte[] extensionData) { + this.extensionData = new OctetString(extensionData); + } + + + +} diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateSystemType.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateSystemType.java new file mode 100644 index 0000000..b25ad1a --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateSystemType.java @@ -0,0 +1,57 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + + +// TODO: Auto-generated Javadoc +/** + * The Enum GeoCoordinateSystemType. + */ +public enum GeoCoordinateSystemType { + + /** The wgs 84. */ + wgs84("wgs84"), + + /** The grs 80. */ + grs80("grs80"); + + + /** The text. */ + public String text; + + /** + * Instantiates a new geo coordinate system type. + * + * @param text the text + */ + GeoCoordinateSystemType(String text) { + this.text = text; + } + + /** + * To string. + * + * @return the string + */ + public String toString(){ + return text; + } +} + diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateType.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateType.java new file mode 100644 index 0000000..1f1cfc5 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoCoordinateType.java @@ -0,0 +1,144 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +import org.uic.barcode.asn1.datatypes.Asn1BigInteger; +import org.uic.barcode.asn1.datatypes.Asn1Default; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.Sequence; + +@Sequence +public class GeoCoordinateType extends Object { + public GeoCoordinateType() { + } + + @FieldOrder(order = 0) + @Asn1Default(value="milliDegree") + @Asn1Optional public GeoUnitType geoUnit; + + @FieldOrder(order = 1) + @Asn1Default(value="wgs84") + @Asn1Optional public GeoCoordinateSystemType coordinateSystem; + + @FieldOrder(order = 2) + @Asn1Default(value="north") + @Asn1Optional public HemisphereLongitudeType hemisphereLongitude; + + @FieldOrder(order = 3) + @Asn1Default(value="east") + @Asn1Optional public HemisphereLatitudeType hemisphereLatitude; + + @FieldOrder(order = 4) + public Asn1BigInteger longitude; + + @FieldOrder(order = 5) + public Asn1BigInteger latitude; + + @FieldOrder(order = 6) + @Asn1Optional public GeoUnitType accuracy; + + public GeoUnitType getGeoUnit() { + + if (geoUnit == null){ + return GeoUnitType.milliDegree; + } + return this.geoUnit; + } + + public GeoCoordinateSystemType getCoordinateSystem() { + + if (coordinateSystem == null) { + return GeoCoordinateSystemType.wgs84; + } + + return this.coordinateSystem; + } + + public HemisphereLongitudeType getHemisphereLongitude() { + + if (hemisphereLongitude == null){ + return HemisphereLongitudeType.north; + } + + return this.hemisphereLongitude; + } + + public HemisphereLatitudeType getHemisphereLatitude() { + + if (hemisphereLatitude == null) { + return HemisphereLatitudeType.east; + } + + return this.hemisphereLatitude; + } + + public Long getLongitude() { + + return Asn1BigInteger.toLong(this.longitude); + } + + public Long getLatitude() { + + return Asn1BigInteger.toLong(this.latitude); + } + + public GeoUnitType getAccuracy() { + + return this.accuracy; + } + + public void setGeoUnit(GeoUnitType geoUnit) { + + this.geoUnit = geoUnit; + } + + public void setCoordinateSystem(GeoCoordinateSystemType coordinateSystem) { + + this.coordinateSystem = coordinateSystem; + } + + public void setHemisphereLongitude(HemisphereLongitudeType hemisphereLongitude) { + + this.hemisphereLongitude = hemisphereLongitude; + } + + public void setHemisphereLatitude(HemisphereLatitudeType hemisphereLatitude) { + + this.hemisphereLatitude = hemisphereLatitude; + } + + public void setLongitude(Long longitude) { + + this.longitude = Asn1BigInteger.toAsn1(longitude); + } + + public void setLatitude(Long latitude) { + + this.latitude = Asn1BigInteger.toAsn1(latitude); + } + + public void setAccuracy(GeoUnitType accuracy) { + + this.accuracy = accuracy; + } + + +} diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoUnitType.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoUnitType.java new file mode 100644 index 0000000..4eaa8c9 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/GeoUnitType.java @@ -0,0 +1,65 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +// TODO: Auto-generated Javadoc +/** + * The Enum GeoUnitType. + */ +public enum GeoUnitType { + + /** The micro degree. */ + microDegree("microDegree"), + + /** The tenthmilli degree. */ + tenthmilliDegree("tenthmilliDegree"), + + /** The milli degree. */ + milliDegree("milliDegree"), + + /** The centi degree. */ + centiDegree("centiDegree"), + + /** The deci degree. */ + deciDegree("deciDegree"); + + + /** The text. */ + public String text; + + /** + * Instantiates a new geo unit type. + * + * @param text the text + */ + GeoUnitType(String text) { + this.text = text; + } + + /** + * To string. + * + * @return the string + */ + public String toString(){ + return text; + } +} + diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLatitudeType.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLatitudeType.java new file mode 100644 index 0000000..5157b0e --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLatitudeType.java @@ -0,0 +1,56 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +// TODO: Auto-generated Javadoc +/** + * The Enum HemisphereLatitudeType. + */ +public enum HemisphereLatitudeType { + + /** The east. */ + east("east"), + + /** The west. */ + west("west"); + + + /** The text. */ + public String text; + + /** + * Instantiates a new hemisphere latitude type. + * + * @param text the text + */ + HemisphereLatitudeType(String text) { + this.text = text; + } + + /** + * To string. + * + * @return the string + */ + public String toString(){ + return text; + } +} + diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLongitudeType.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLongitudeType.java new file mode 100644 index 0000000..c0e33e6 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/HemisphereLongitudeType.java @@ -0,0 +1,55 @@ +/* + * This file was generated by openASN.1 - an open source ASN.1 toolkit for java + * + * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland + * + * openASN.1 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * openASN.1 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with openASN.1. If not, see . + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +// TODO: Auto-generated Javadoc +/** + * The Enum HemisphereLongitudeType. + */ +public enum HemisphereLongitudeType { + + /** The north. */ + north("north"), + + /** The south. */ + south("south"); + + /** The text. */ + public String text; + + /** + * Instantiates a new hemisphere longitude type. + * + * @param text the text + */ + HemisphereLongitudeType(String text) { + this.text = text; + } + + /** + * To string. + * + * @return the string + */ + public String toString(){ + return text; + } +} + diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/SequenceOfExtension.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/SequenceOfExtension.java new file mode 100644 index 0000000..38833df --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/SequenceOfExtension.java @@ -0,0 +1,11 @@ +package org.uic.barcode.dynamicContent.fdc1; + +import java.util.Collection; + +import org.uic.barcode.asn1.datatypes.Asn1SequenceOf; +import org.uic.barcode.ticket.api.asn.omv2.TravelerType; + +public class SequenceOfExtension extends Asn1SequenceOf { + public SequenceOfExtension() { super(); } + public SequenceOfExtension(Collection coll) { super(coll); } +} diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/TimeStamp.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/TimeStamp.java new file mode 100644 index 0000000..32cce65 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/TimeStamp.java @@ -0,0 +1,144 @@ +package org.uic.barcode.dynamicContent.fdc1; + +import java.time.Instant; +import java.time.temporal.ChronoField; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.IntRange; +import org.uic.barcode.asn1.datatypes.Sequence; + +// TODO: Auto-generated Javadoc +/** + * The Class TimeStamp. + */ +@Sequence +public class TimeStamp { + + + /* + -- Moment of generation of the dynamic content, expressed in UTC : + -- * dynamicContentDay is the number of days from issuing date + -- (UicRailTicketData.issuingDetail.issuingYear and issuingDay) + -- The range 0..1070 allows a validity equal to that of the validFrom (700) plus + -- validUntil (370) elements of the different transport documents of UicRailTicketData. + -- * dynamicContentTime is the number of seconds of the day + -- (from 0 = 0:00:00 to 86399 = 23:59:59) + -- These two elements shall be either both present, either both absent + dynamicContentDay INTEGER (0..366), + * + */ + @FieldOrder(order = 0) + @IntRange(minValue=1, maxValue=366) + public Long day; + + /** The second of day. */ + // dynamicContentTime INTEGER (0..86399) OPTIONAL, + @FieldOrder(order = 1) + @IntRange(minValue=0, maxValue=86399) + public Long secondOfDay; + + + + /** + * Instantiates a new time stamp and sets the time-stamp to now. + */ + public TimeStamp() { + Instant now = Instant.now(); + day = new Long(now.get(ChronoField.DAY_OF_YEAR)); + secondOfDay = new Long(now.get(ChronoField.SECOND_OF_DAY)); + } + + /** + * Sets the the time-stamp to now. + */ + public void setNow() { + Instant now = Instant.now(); + day = new Long(now.get(ChronoField.DAY_OF_YEAR)); + secondOfDay = new Long(now.get(ChronoField.SECOND_OF_DAY)); + } + + /** + * Gets the day. + * + * @return the day + */ + public Long getDay() { + return day; + } + + /** + * Sets the day. + * + * @param day the new day + */ + public void setDay(Long day) { + this.day = day; + } + + /** + * Gets the time. + * + * @return the time + */ + public Long getTime() { + return secondOfDay; + } + + /** + * Sets the time. + * + * @param time the new time + */ + public void setTime(Long time) { + this.secondOfDay = time; + } + + /** + * Gets the time. + * + * @return the date and time of content creation in UTC + */ + public Date getTimeAsDate() { + + Calendar cal = Calendar.getInstance(); + int dayOfYear = cal.get(Calendar.DAY_OF_YEAR); + + if (dayOfYear - day.intValue() > 250) { + cal.add(Calendar.YEAR, 1); + } + if (day.intValue() - dayOfYear > 250) { + cal.add(Calendar.YEAR, -1); + } + + cal.setTimeZone(TimeZone.getTimeZone("UTC")); + cal.set(Calendar.SECOND,0); + cal.set(Calendar.HOUR,0); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.DAY_OF_YEAR, day.intValue()); + cal.add(Calendar.SECOND, secondOfDay.intValue()); + + return cal.getTime(); + } + + /** + * Sets the date time. + * + * @param dateUTC the current date and time in UTC + */ + public void setDateTime(Date dateUTC) { + + Calendar cal = Calendar.getInstance(); + cal.setTime(dateUTC); + + day = Long.valueOf(cal.get(Calendar.DAY_OF_YEAR)); + + secondOfDay = (long) cal.get(Calendar.SECOND); + secondOfDay = secondOfDay + 60 * (long) cal.get(Calendar.MINUTE); + secondOfDay = secondOfDay + 60 * 60 * (long) cal.get(Calendar.HOUR_OF_DAY); + + } + +} diff --git a/src/main/java/org/uic/barcode/dynamicContent/fdc1/UicDynamicContentDataFDC1.java b/src/main/java/org/uic/barcode/dynamicContent/fdc1/UicDynamicContentDataFDC1.java new file mode 100644 index 0000000..ce6d1b3 --- /dev/null +++ b/src/main/java/org/uic/barcode/dynamicContent/fdc1/UicDynamicContentDataFDC1.java @@ -0,0 +1,205 @@ +/* + * + */ +package org.uic.barcode.dynamicContent.fdc1; + +import java.io.UnsupportedEncodingException; +import org.uic.barcode.asn1.datatypes.Asn1Optional; +import org.uic.barcode.asn1.datatypes.CharacterRestriction; +import org.uic.barcode.asn1.datatypes.FieldOrder; +import org.uic.barcode.asn1.datatypes.HasExtensionMarker; +import org.uic.barcode.asn1.datatypes.RestrictedString; +import org.uic.barcode.asn1.datatypes.Sequence; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.dynamicContent.DynamicContent; +import org.uic.barcode.dynamicFrame.DataType; + + +/** + * The Class UicDynamicContentData. + * + * The dynamic content for FDC1 + * + */ + + + + +@Sequence +@HasExtensionMarker +public class UicDynamicContentDataFDC1 { + + + + /* + -- The possible values are defined by the security provider + -- (the security provider being UicBarcodeHeader.level2SignedData.level1Data.securityProviderNum/IA5) + dynamicContentMobileAppId IA5String OPTIONAL, + */ + //timestamp when the bar code was created + @FieldOrder(order = 0) + @RestrictedString(CharacterRestriction.IA5String) + @Asn1Optional public String appId; + + //timestamp when the bar code was created + @FieldOrder(order = 1) + @Asn1Optional public TimeStamp timeStamp; + + + //-- Coordinates of the place where the dynamic content has been generated + // -- (same GeoCoordinateType type as in UicRailTicketData) + /** The geo coordinate. */ + //dynamicContentGeoCoordinate GeoCoordinateType OPTIONAL, + @FieldOrder(order = 2) + @Asn1Optional public GeoCoordinateType geoCoordinate; + //-- Response from the mobile to any data received from the terminal. + //-- The data received from the terminal may be a random number, or any other information. + //-- The response may be the data itself, a hashing of this data, or any other response. + // -- This response may be completed with other information: IMEI, mobile phone number... + //-- The type used is ExtensionData, as it is fully adapted. + // -- extensionId shall be set to: + // -- * "=" if the data included in extensionData is exactly the one that was transmitted by the terminal, + // -- * any other value (chosen by the issuer) in other cases. + /** The challenge response. */ + + @FieldOrder(order = 3) + @Asn1Optional public SequenceOfExtension extensions; + + + + //... + + + + /** + * Gets the geo coordinate. + * + * @return the geo coordinate + */ + public GeoCoordinateType getGeoCoordinate() { + return geoCoordinate; + } + + /** + * Sets the geo coordinate. + * + * @param geoCoordinate the new geo coordinate + */ + public void setGeoCoordinate(GeoCoordinateType geoCoordinate) { + this.geoCoordinate = geoCoordinate; + } + + public static String getFormat() { + return "FDC1"; + } + + public DataType getDataType() { + DataType data = new DataType(); + data.setFormat(getFormat()); + data.setByteData(UperEncoder.encode(this)); + return data; + } + + public String getChallengeString() { + if (this.extensions != null) { + for (ExtensionData ed : extensions) { + if (ed.getExtensionId().equals("=")) { + byte[] c = ed.getExtensionData(); + try { + return new String(c,"UTF-8"); + } catch (UnsupportedEncodingException e) { + return null; + } + } + } + } + return null; + } + + public void setChallengeString(String challengeString) { + if (extensions == null) { + extensions = new SequenceOfExtension(); + }; + ExtensionData ed = new ExtensionData(); + ed.setExtensionId("="); + try { + ed.setExtensionData(challengeString.getBytes("UTF-8")); + } catch (UnsupportedEncodingException e) { + return; + } + extensions.add(ed); + } + + public byte[] getPhoneIdHash() { + if (this.extensions != null) { + for (ExtensionData ed : extensions) { + if (ed.getExtensionId().equals("phone")) { + return ed.getExtensionData(); + } + } + } + return null; + } + + public void setPhoneIdHash(byte[] phoneIdHash) { + if (extensions == null) { + extensions = new SequenceOfExtension(); + }; + ExtensionData ed = new ExtensionData(); + ed.setExtensionId("phone"); + ed.setExtensionData(phoneIdHash); + extensions.add(ed); + } + + public byte[] getPassIdHash() { + if (this.extensions != null) { + for (ExtensionData ed : extensions) { + if (ed.getExtensionId().equals("pass")) { + return ed.getExtensionData(); + } + } + } + return null; + } + + public void setPassIdHash(byte[] phoneIdHash) { + if (extensions == null) { + extensions = new SequenceOfExtension(); + }; + ExtensionData ed = new ExtensionData(); + ed.setExtensionId("pass"); + ed.setExtensionData(phoneIdHash); + extensions.add(ed); + } + + public TimeStamp getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(TimeStamp timeStamp) { + this.timeStamp = timeStamp; + } + + public SequenceOfExtension getExtensions() { + return extensions; + } + + public void setExtensions(SequenceOfExtension extensions) { + this.extensions = extensions; + } + + public byte[] encode() { + return UperEncoder.encode(this); + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + + +} -- cgit v1.2.3