summaryrefslogtreecommitdiffstats
path: root/bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java
diff options
context:
space:
mode:
Diffstat (limited to 'bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java')
-rw-r--r--bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java38
1 files changed, 35 insertions, 3 deletions
diff --git a/bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java b/bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java
index b65ab5e..79ec0a0 100644
--- a/bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java
+++ b/bcpkix/src/main/java/org/bouncycastle/cms/SignerInformationStore.java
@@ -7,13 +7,37 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.bouncycastle.util.Iterable;
+
public class SignerInformationStore
+ implements Iterable<SignerInformation>
{
private List all = new ArrayList();
private Map table = new HashMap();
+ /**
+ * Create a store containing a single SignerInformation object.
+ *
+ * @param signerInfo the signer information to contain.
+ */
+ public SignerInformationStore(
+ SignerInformation signerInfo)
+ {
+ this.all = new ArrayList(1);
+ this.all.add(signerInfo);
+
+ SignerId sid = signerInfo.getSID();
+
+ table.put(sid, all);
+ }
+
+ /**
+ * Create a store containing a collection of SignerInformation objects.
+ *
+ * @param signerInfos a collection signer information objects to contain.
+ */
public SignerInformationStore(
- Collection signerInfos)
+ Collection<SignerInformation> signerInfos)
{
Iterator it = signerInfos.iterator();
@@ -65,7 +89,7 @@ public class SignerInformationStore
*
* @return a collection of signers.
*/
- public Collection getSigners()
+ public Collection<SignerInformation> getSigners()
{
return new ArrayList(all);
}
@@ -76,7 +100,7 @@ public class SignerInformationStore
* @param selector a signer id to select against.
* @return a collection of SignerInformation objects.
*/
- public Collection getSigners(
+ public Collection<SignerInformation> getSigners(
SignerId selector)
{
if (selector.getIssuer() != null && selector.getSubjectKeyIdentifier() != null)
@@ -106,4 +130,12 @@ public class SignerInformationStore
return list == null ? new ArrayList() : new ArrayList(list);
}
}
+
+ /**
+ * Support method for Iterable where available.
+ */
+ public Iterator<SignerInformation> iterator()
+ {
+ return getSigners().iterator();
+ }
}