blob: eb6b3ca3001c60a3afb2afee79b2b1813898cf64 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
using System;
namespace Org.BouncyCastle.Asn1.X500
{
/**
* Holding class for the AttributeTypeAndValue structures that make up an RDN.
*/
public class AttributeTypeAndValue
: Asn1Encodable
{
private readonly DerObjectIdentifier type;
private readonly Asn1Encodable value;
private AttributeTypeAndValue(Asn1Sequence seq)
{
type = (DerObjectIdentifier)seq[0];
value = seq[1];
}
public static AttributeTypeAndValue GetInstance(object obj)
{
if (obj is AttributeTypeAndValue)
return (AttributeTypeAndValue)obj;
if (null != obj)
return new AttributeTypeAndValue(Asn1Sequence.GetInstance(obj));
throw new ArgumentNullException("obj");
}
public AttributeTypeAndValue(
DerObjectIdentifier type,
Asn1Encodable value)
{
this.type = type;
this.value = value;
}
public virtual DerObjectIdentifier Type
{
get { return type; }
}
public virtual Asn1Encodable Value
{
get { return value; }
}
/**
* <pre>
* AttributeTypeAndValue ::= SEQUENCE {
* type OBJECT IDENTIFIER,
* value ANY DEFINED BY type }
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
return new DerSequence(type, value);
}
}
}
|