OtherName
using System;
namespace Org.BouncyCastle.Asn1.X509
{
public class OtherName : Asn1Encodable
{
private readonly DerObjectIdentifier m_typeID;
private readonly Asn1Encodable m_value;
public virtual DerObjectIdentifier TypeID => m_typeID;
public Asn1Encodable Value => m_value;
public static OtherName GetInstance(object obj)
{
if (obj == null)
return null;
OtherName otherName = obj as OtherName;
if (otherName != null)
return otherName;
return new OtherName(Asn1Sequence.GetInstance(obj));
}
public static OtherName GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new OtherName(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
}
public static OtherName GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new OtherName(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
}
private OtherName(Asn1Sequence seq)
{
int count = seq.Count;
if (count != 2)
throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq");
m_typeID = DerObjectIdentifier.GetInstance(seq[0]);
m_value = Asn1TaggedObject.GetInstance(seq[1], 128, 0).GetExplicitBaseObject();
}
public OtherName(DerObjectIdentifier typeID, Asn1Encodable value)
{
if (typeID == null)
throw new ArgumentNullException("typeID");
m_typeID = typeID;
if (value == null)
throw new ArgumentNullException("value");
m_value = value;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(m_typeID, new DerTaggedObject(true, 0, m_value));
}
}
}