summary refs log tree commit diff
path: root/crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs
blob: 53a8e98a72c034fa4ff9711254fdbb471cbbac62 (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
using System;

using Org.BouncyCastle.Asn1.X500;
using Org.BouncyCastle.Utilities;

namespace Org.BouncyCastle.Asn1.IsisMtt.X509
{
	/**
	* Some other information of non-restrictive nature regarding the usage of this
	* certificate.
	* 
	* <pre>
	*    AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
	* </pre>
	*/
	public class AdditionalInformationSyntax
		: Asn1Encodable
	{
		private readonly DirectoryString information;

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

			if (obj is IAsn1String)
				return new AdditionalInformationSyntax(DirectoryString.GetInstance(obj));

            throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
		}

		private AdditionalInformationSyntax(
			DirectoryString information)
		{
			this.information = information;
		}

		/**
		* Constructor from a given details.
		*
		* @param information The describtion of the information.
		*/
		public AdditionalInformationSyntax(
			string information)
		{
			this.information = new DirectoryString(information);
		}

		public virtual DirectoryString Information
		{
			get { return information; }
		}

		/**
		* Produce an object suitable for an Asn1OutputStream.
		* <p/>
		* Returns:
		* <p/>
		* <pre>
		*   AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
		* </pre>
		*
		* @return an Asn1Object
		*/
		public override Asn1Object ToAsn1Object()
		{
			return information.ToAsn1Object();
		}
	}
}