CertId.cs
1.52 KB
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
using System;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Crmf
{
public class CertId
: Asn1Encodable
{
private readonly GeneralName issuer;
private readonly DerInteger serialNumber;
private CertId(Asn1Sequence seq)
{
issuer = GeneralName.GetInstance(seq[0]);
serialNumber = DerInteger.GetInstance(seq[1]);
}
public static CertId GetInstance(object obj)
{
if (obj is CertId)
return (CertId)obj;
if (obj is Asn1Sequence)
return new CertId((Asn1Sequence)obj);
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
}
public static CertId GetInstance(Asn1TaggedObject obj, bool isExplicit)
{
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
}
public virtual GeneralName Issuer
{
get { return issuer; }
}
public virtual DerInteger SerialNumber
{
get { return serialNumber; }
}
/**
* <pre>
* CertId ::= SEQUENCE {
* issuer GeneralName,
* serialNumber INTEGER }
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
return new DerSequence(issuer, serialNumber);
}
}
}