01: package org.bouncycastle.asn1.isismtt.x509;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.DERObject;
05: import org.bouncycastle.asn1.DERString;
06: import org.bouncycastle.asn1.x500.DirectoryString;
07:
08: /**
09: * Some other information of non-restrictive nature regarding the usage of this
10: * certificate.
11: *
12: * <pre>
13: * AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
14: * </pre>
15: */
16: public class AdditionalInformationSyntax extends ASN1Encodable {
17: private DirectoryString information;
18:
19: public static AdditionalInformationSyntax getInstance(Object obj) {
20: if (obj == null || obj instanceof AdditionalInformationSyntax) {
21: return (AdditionalInformationSyntax) obj;
22: }
23:
24: if (obj instanceof DERString) {
25: return new AdditionalInformationSyntax(DirectoryString
26: .getInstance(obj));
27: }
28:
29: throw new IllegalArgumentException(
30: "illegal object in getInstance: "
31: + obj.getClass().getName());
32: }
33:
34: private AdditionalInformationSyntax(DirectoryString information) {
35: this .information = information;
36: }
37:
38: /**
39: * Constructor from a given details.
40: *
41: * @param information The describtion of the information.
42: */
43: public AdditionalInformationSyntax(String information) {
44: this (new DirectoryString(information));
45: }
46:
47: public DirectoryString getInformation() {
48: return information;
49: }
50:
51: /**
52: * Produce an object suitable for an ASN1OutputStream.
53: * <p/>
54: * Returns:
55: * <p/>
56: * <pre>
57: * AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
58: * </pre>
59: *
60: * @return a DERObject
61: */
62: public DERObject toASN1Object() {
63: return information.toASN1Object();
64: }
65: }
|