summaryrefslogtreecommitdiffstats
path: root/src/org/uic/header/DynamicHeader.java
blob: 011fe19c3dbcaafe299dfd4a55778e6feac8ba57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
package org.uic.header;

import org.uic.ticket.api.asn.omv1.UicRailTicketData;

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.
	 *
	 * @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;
	}
	
	
	/**
	 * 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);	
	}
	


}