blob: 010684158202b6ddf57dfb3d026972c0f4ee0a7c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
using System;
namespace Org.BouncyCastle.Asn1.Cms
{
public class Attributes
: Asn1Encodable
{
public static Attributes GetInstance(object obj)
{
if (obj == null)
return null;
if (obj is Attributes attributes)
return attributes;
return new Attributes(Asn1Set.GetInstance(obj));
}
public static Attributes GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return GetInstance(Asn1Set.GetInstance(taggedObject, declaredExplicit));
}
private readonly Asn1Set m_attributes;
private Attributes(Asn1Set attributes)
{
m_attributes = attributes;
}
public Attributes(Asn1EncodableVector v)
{
m_attributes = new BerSet(v);
}
public virtual Attribute[] GetAttributes() => m_attributes.MapElements(Attribute.GetInstance);
/**
* <pre>
* Attributes ::=
* SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
* </pre>
* @return
*/
public override Asn1Object ToAsn1Object() => m_attributes;
}
}
|