blob: 618add6e071461ed159ea75d7c2d85ef0a6c3ee5 (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
using System;
using System.Collections;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.Cms;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Utilities;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.X509.Store;
namespace Org.BouncyCastle.Cms
{
public class OriginatorInformation
{
private readonly OriginatorInfo originatorInfo;
internal OriginatorInformation(OriginatorInfo originatorInfo)
{
this.originatorInfo = originatorInfo;
}
/**
* Return the certificates stored in the underlying OriginatorInfo object.
*
* @return a Store of X509CertificateHolder objects.
*/
public virtual IX509Store GetCertificates()
{
Asn1Set certSet = originatorInfo.Certificates;
if (certSet != null)
{
IList certList = Platform.CreateArrayList(certSet.Count);
foreach (Asn1Encodable enc in certSet)
{
Asn1Object obj = enc.ToAsn1Object();
if (obj is Asn1Sequence)
{
certList.Add(new X509Certificate(X509CertificateStructure.GetInstance(obj)));
}
}
return X509StoreFactory.Create(
"Certificate/Collection",
new X509CollectionStoreParameters(certList));
}
return X509StoreFactory.Create(
"Certificate/Collection",
new X509CollectionStoreParameters(Platform.CreateArrayList()));
}
/**
* Return the CRLs stored in the underlying OriginatorInfo object.
*
* @return a Store of X509CRLHolder objects.
*/
public virtual IX509Store GetCrls()
{
Asn1Set crlSet = originatorInfo.Certificates;
if (crlSet != null)
{
IList crlList = Platform.CreateArrayList(crlSet.Count);
foreach (Asn1Encodable enc in crlSet)
{
Asn1Object obj = enc.ToAsn1Object();
if (obj is Asn1Sequence)
{
crlList.Add(new X509Crl(CertificateList.GetInstance(obj)));
}
}
return X509StoreFactory.Create(
"CRL/Collection",
new X509CollectionStoreParameters(crlList));
}
return X509StoreFactory.Create(
"CRL/Collection",
new X509CollectionStoreParameters(Platform.CreateArrayList()));
}
/**
* Return the underlying ASN.1 object defining this SignerInformation object.
*
* @return a OriginatorInfo.
*/
public virtual OriginatorInfo ToAsn1Structure()
{
return originatorInfo;
}
}
}
|