AccessDescription
using System;
namespace Org.BouncyCastle.Asn1.X509
{
public class AccessDescription : Asn1Encodable
{
public static readonly DerObjectIdentifier IdADCAIssuers = X509ObjectIdentifiers.IdADCAIssuers;
public static readonly DerObjectIdentifier IdADOcsp = X509ObjectIdentifiers.IdADOcsp;
private readonly DerObjectIdentifier m_accessMethod;
private readonly GeneralName m_accessLocation;
public DerObjectIdentifier AccessMethod => m_accessMethod;
public GeneralName AccessLocation => m_accessLocation;
public static AccessDescription GetInstance(object obj)
{
if (obj == null)
return null;
AccessDescription accessDescription = obj as AccessDescription;
if (accessDescription != null)
return accessDescription;
return new AccessDescription(Asn1Sequence.GetInstance(obj));
}
public static AccessDescription GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new AccessDescription(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
}
public static AccessDescription GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new AccessDescription(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
}
private AccessDescription(Asn1Sequence seq)
{
int count = seq.Count;
if (count != 2)
throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq");
m_accessMethod = DerObjectIdentifier.GetInstance(seq[0]);
m_accessLocation = GeneralName.GetInstance(seq[1]);
}
public AccessDescription(DerObjectIdentifier oid, GeneralName location)
{
if (oid == null)
throw new ArgumentNullException("oid");
m_accessMethod = oid;
if (location == null)
throw new ArgumentNullException("location");
m_accessLocation = location;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(m_accessMethod, m_accessLocation);
}
public override string ToString()
{
return "AccessDescription: Oid(" + m_accessMethod.Id + ")";
}
}
}