summary refs log tree commit diff
path: root/crypto/src/asn1/pkcs/CertBag.cs
blob: b6f4c8a307f206d9a1c2df43803ca463022f5024 (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
using System;

namespace Org.BouncyCastle.Asn1.Pkcs
{
    public class CertBag
        : Asn1Encodable
    {
//		private readonly Asn1Sequence seq;
        private readonly DerObjectIdentifier certID;
        private readonly Asn1Object certValue;

		public CertBag(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Wrong number of elements in sequence", "seq");

//			this.seq = seq;
            this.certID = DerObjectIdentifier.GetInstance(seq[0]);
            this.certValue = DerTaggedObject.GetInstance(seq[1]).GetObject();
        }

		public CertBag(
            DerObjectIdentifier	certID,
            Asn1Object			certValue)
        {
            this.certID = certID;
            this.certValue = certValue;
        }

		public DerObjectIdentifier CertID
		{
			get { return certID; }
		}

		public Asn1Object CertValue
		{
			get { return certValue; }
		}

		public override Asn1Object ToAsn1Object()
        {
			return new DerSequence(certID, new DerTaggedObject(0, certValue));
        }
    }
}