blob: bd613843d74ecf50289089d795c3eef3a4ea1438 (
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
|
using System;
using System.Collections;
using System.IO;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Cms
{
public class SignerInformationStore
{
private readonly IList all; //ArrayList[SignerInformation]
private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[SignerID, ArrayList[SignerInformation]]
public SignerInformationStore(
ICollection signerInfos)
{
foreach (SignerInformation signer in signerInfos)
{
SignerID sid = signer.SignerID;
IList list = (IList)table[sid];
if (list == null)
{
table[sid] = list = Platform.CreateArrayList(1);
}
list.Add(signer);
}
this.all = Platform.CreateArrayList(signerInfos);
}
/**
* Return the first SignerInformation object that matches the
* passed in selector. Null if there are no matches.
*
* @param selector to identify a signer
* @return a single SignerInformation object. Null if none matches.
*/
public SignerInformation GetFirstSigner(
SignerID selector)
{
IList list = (IList) table[selector];
return list == null ? null : (SignerInformation) list[0];
}
/// <summary>The number of signers in the collection.</summary>
public int Count
{
get { return all.Count; }
}
/// <returns>An ICollection of all signers in the collection</returns>
public ICollection GetSigners()
{
return Platform.CreateArrayList(all);
}
/**
* Return possible empty collection with signers matching the passed in SignerID
*
* @param selector a signer id to select against.
* @return a collection of SignerInformation objects.
*/
public ICollection GetSigners(
SignerID selector)
{
IList list = (IList) table[selector];
return list == null ? Platform.CreateArrayList() : Platform.CreateArrayList(list);
}
}
}
|