From 887af5108d1bcc79f8dcedb92ac5510f32dc5aa5 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Thu, 30 Apr 2020 15:56:20 +0200 Subject: header class update --- src/org/uic/header/DynamicHeader.java | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/org') 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. -- cgit v1.2.3