AttributePkcs
using System;
namespace Org.BouncyCastle.Asn1.Pkcs
{
public class AttributePkcs : Asn1Encodable
{
private readonly DerObjectIdentifier m_attrType;
private readonly Asn1Set m_attrValues;
public DerObjectIdentifier AttrType => m_attrType;
public Asn1Set AttrValues => m_attrValues;
public static AttributePkcs GetInstance(object obj)
{
if (obj == null)
return null;
AttributePkcs attributePkcs = obj as AttributePkcs;
if (attributePkcs != null)
return attributePkcs;
return new AttributePkcs(Asn1Sequence.GetInstance(obj));
}
public static AttributePkcs GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new AttributePkcs(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
}
public static AttributePkcs GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new AttributePkcs(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
}
private AttributePkcs(Asn1Sequence seq)
{
int count = seq.Count;
if (count != 2)
throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq");
m_attrType = DerObjectIdentifier.GetInstance(seq[0]);
m_attrValues = Asn1Set.GetInstance(seq[1]);
}
public AttributePkcs(DerObjectIdentifier attrType, Asn1Set attrValues)
{
if (attrType == null)
throw new ArgumentNullException("attrType");
m_attrType = attrType;
if (attrValues == null)
throw new ArgumentNullException("attrValues");
m_attrValues = attrValues;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(m_attrType, m_attrValues);
}
}
}