001package org.apache.commons.ssl.org.bouncycastle.asn1.isismtt.x509;
002
003import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Object;
004import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Primitive;
005import org.apache.commons.ssl.org.bouncycastle.asn1.x500.DirectoryString;
006
007/**
008 * Some other information of non-restrictive nature regarding the usage of this
009 * certificate.
010 * 
011 * <pre>
012 *    AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
013 * </pre>
014 */
015public class AdditionalInformationSyntax
016    extends ASN1Object
017{
018    private DirectoryString information;
019
020    public static AdditionalInformationSyntax getInstance(Object obj)
021    {
022        if (obj instanceof AdditionalInformationSyntax)
023        {
024            return (AdditionalInformationSyntax)obj;
025        }
026
027        if (obj != null)
028        {
029            return new AdditionalInformationSyntax(DirectoryString.getInstance(obj));
030        }
031
032        return null;
033    }
034
035    private AdditionalInformationSyntax(DirectoryString information)
036    {
037        this.information = information;
038    }
039
040    /**
041     * Constructor from a given details.
042     *
043     * @param information The describtion of the information.
044     */
045    public AdditionalInformationSyntax(String information)
046    {
047        this(new DirectoryString(information));
048    }
049
050    public DirectoryString getInformation()
051    {
052        return information;
053    }
054
055    /**
056     * Produce an object suitable for an ASN1OutputStream.
057     * <p>
058     * Returns:
059     * <pre>
060     *   AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
061     * </pre>
062     *
063     * @return a DERObject
064     */
065    public ASN1Primitive toASN1Primitive()
066    {
067        return information.toASN1Primitive();
068    }
069}