summary refs log tree commit diff
path: root/crypto/src/asn1/icao/LDSVersionInfo.cs
blob: 2cdcad2dbabe2381b201c36d38ccf2e96f0f635c (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
using System;

namespace Org.BouncyCastle.Asn1.Icao
{
	public class LdsVersionInfo
		: Asn1Encodable
	{
		private DerPrintableString ldsVersion;
		private DerPrintableString unicodeVersion;

		public LdsVersionInfo(string ldsVersion, string unicodeVersion)
		{
			this.ldsVersion = new DerPrintableString(ldsVersion);
			this.unicodeVersion = new DerPrintableString(unicodeVersion);
		}

		private LdsVersionInfo(Asn1Sequence seq)
		{
			if (seq.Count != 2)
				throw new ArgumentException("sequence wrong size for LDSVersionInfo", "seq");

			this.ldsVersion = DerPrintableString.GetInstance(seq[0]);
			this.unicodeVersion = DerPrintableString.GetInstance(seq[1]);
		}

		public static LdsVersionInfo GetInstance(object obj)
		{
			if (obj is LdsVersionInfo)
				return (LdsVersionInfo)obj;

			if (obj != null)
				return new LdsVersionInfo(Asn1Sequence.GetInstance(obj));

			return null;
		}

		public virtual string GetLdsVersion()
		{
			return ldsVersion.GetString();
		}

		public virtual string GetUnicodeVersion()
		{
			return unicodeVersion.GetString();
		}

		/**
		 * <pre>
		 * LDSVersionInfo ::= SEQUENCE {
		 *    ldsVersion PRINTABLE STRING
		 *    unicodeVersion PRINTABLE STRING
		 *  }
		 * </pre>
		 * @return
		 */
		public override Asn1Object ToAsn1Object()
		{
			return new DerSequence(ldsVersion, unicodeVersion);
		}
	}
}