PKIPublicationInfo.cs
1.98 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
60
61
62
63
64
65
66
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Crmf
{
public class PkiPublicationInfo
: Asn1Encodable
{
private readonly DerInteger action;
private readonly Asn1Sequence pubInfos;
private PkiPublicationInfo(Asn1Sequence seq)
{
action = DerInteger.GetInstance(seq[0]);
pubInfos = Asn1Sequence.GetInstance(seq[1]);
}
public static PkiPublicationInfo GetInstance(object obj)
{
if (obj is PkiPublicationInfo)
return (PkiPublicationInfo)obj;
if (obj is Asn1Sequence)
return new PkiPublicationInfo((Asn1Sequence)obj);
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
}
public virtual DerInteger Action
{
get { return action; }
}
public virtual SinglePubInfo[] GetPubInfos()
{
if (pubInfos == null)
return null;
SinglePubInfo[] results = new SinglePubInfo[pubInfos.Count];
for (int i = 0; i != results.Length; ++i)
{
results[i] = SinglePubInfo.GetInstance(pubInfos[i]);
}
return results;
}
/**
* <pre>
* PkiPublicationInfo ::= SEQUENCE {
* action INTEGER {
* dontPublish (0),
* pleasePublish (1) },
* pubInfos SEQUENCE SIZE (1..MAX) OF SinglePubInfo OPTIONAL }
* -- pubInfos MUST NOT be present if action is "dontPublish"
* -- (if action is "pleasePublish" and pubInfos is omitted,
* -- "dontCare" is assumed)
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
return new DerSequence(action, pubInfos);
}
}
}