diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2020-04-30 15:56:20 +0200 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2020-04-30 15:56:20 +0200 |
commit | 887af5108d1bcc79f8dcedb92ac5510f32dc5aa5 (patch) | |
tree | 9c3b682cc832102b26e676f2531ed4a8cfc1f4e1 | |
parent | header encode / decode (diff) | |
download | UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar.gz UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar.bz2 UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar.lz UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar.xz UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.tar.zst UIC-barcode-887af5108d1bcc79f8dcedb92ac5510f32dc5aa5.zip |
-rw-r--r-- | src/org/uic/header/DynamicHeader.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/org/uic/header/DynamicHeader.java b/src/org/uic/header/DynamicHeader.java index 011fe19..220e7f2 100644 --- a/src/org/uic/header/DynamicHeader.java +++ b/src/org/uic/header/DynamicHeader.java @@ -1,6 +1,7 @@ package org.uic.header;
-import org.uic.ticket.api.asn.omv1.UicRailTicketData;
+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;
@@ -104,6 +105,8 @@ public class DynamicHeader { /**
* 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
*/
@@ -112,13 +115,39 @@ public class DynamicHeader { }
/**
- * Gets the security provider IA 5.
+ * Gets the security provider IA5.
+ *
+ * in case the security provider code is encoded numerically this will return null
*
- * @return the security provider IA 5
+ * @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.
|