blob: 29d245084a149e87e00c1fbcee3f2b53233965aa (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
using System;
namespace Org.BouncyCastle.Asn1.X509
{
public class PolicyInformation
: Asn1Encodable
{
private readonly DerObjectIdentifier policyIdentifier;
private readonly Asn1Sequence policyQualifiers;
private PolicyInformation(
Asn1Sequence seq)
{
if (seq.Count < 1 || seq.Count > 2)
{
throw new ArgumentException("Bad sequence size: " + seq.Count);
}
policyIdentifier = DerObjectIdentifier.GetInstance(seq[0]);
if (seq.Count > 1)
{
policyQualifiers = Asn1Sequence.GetInstance(seq[1]);
}
}
public PolicyInformation(
DerObjectIdentifier policyIdentifier)
{
this.policyIdentifier = policyIdentifier;
}
public PolicyInformation(
DerObjectIdentifier policyIdentifier,
Asn1Sequence policyQualifiers)
{
this.policyIdentifier = policyIdentifier;
this.policyQualifiers = policyQualifiers;
}
public static PolicyInformation GetInstance(
object obj)
{
if (obj == null || obj is PolicyInformation)
{
return (PolicyInformation) obj;
}
return new PolicyInformation(Asn1Sequence.GetInstance(obj));
}
public DerObjectIdentifier PolicyIdentifier
{
get { return policyIdentifier; }
}
public Asn1Sequence PolicyQualifiers
{
get { return policyQualifiers; }
}
/*
* PolicyInformation ::= Sequence {
* policyIdentifier CertPolicyId,
* policyQualifiers Sequence SIZE (1..MAX) OF
* PolicyQualifierInfo OPTIONAL }
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(policyIdentifier);
if (policyQualifiers != null)
{
v.Add(policyQualifiers);
}
return new DerSequence(v);
}
}
}
|