blob: ddaa353fbcac08b084acc2c0065f7072e7e2be03 (
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
|
using System;
namespace Org.BouncyCastle.Asn1.Pkcs
{
public class CertBag
: Asn1Encodable
{
public static CertBag GetInstance(object obj)
{
if (obj is CertBag)
return (CertBag)obj;
if (obj == null)
return null;
return new CertBag(Asn1Sequence.GetInstance(obj));
}
private readonly DerObjectIdentifier certID;
private readonly Asn1Object certValue;
private CertBag(Asn1Sequence seq)
{
if (seq.Count != 2)
throw new ArgumentException("Wrong number of elements in sequence", "seq");
this.certID = DerObjectIdentifier.GetInstance(seq[0]);
this.certValue = Asn1TaggedObject.GetInstance(seq[1]).GetObject();
}
public CertBag(
DerObjectIdentifier certID,
Asn1Object certValue)
{
this.certID = certID;
this.certValue = certValue;
}
public virtual DerObjectIdentifier CertID
{
get { return certID; }
}
public virtual Asn1Object CertValue
{
get { return certValue; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(certID, new DerTaggedObject(0, certValue));
}
}
}
|