summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-12-11 12:19:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-12-11 12:19:20 +0700
commitb38645667d98f45c482c25e7736a9f43c6678d7b (patch)
tree3b17b62beeea0ca58da0448a83470ecc6fdc9561 /crypto/src/cms
parentUpdate draft references after rename (diff)
downloadBouncyCastle.NET-ed25519-b38645667d98f45c482c25e7736a9f43c6678d7b.tar.xz
Port of a few Java updates
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/SignerInformationStore.cs53
1 files changed, 37 insertions, 16 deletions
diff --git a/crypto/src/cms/SignerInformationStore.cs b/crypto/src/cms/SignerInformationStore.cs
index bd613843d..27940865d 100644
--- a/crypto/src/cms/SignerInformationStore.cs
+++ b/crypto/src/cms/SignerInformationStore.cs
@@ -8,10 +8,31 @@ namespace Org.BouncyCastle.Cms
 {
     public class SignerInformationStore
     {
-		private readonly IList all; //ArrayList[SignerInformation]
-		private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[SignerID, ArrayList[SignerInformation]]
+        private readonly IList all; //ArrayList[SignerInformation]
+        private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[SignerID, ArrayList[SignerInformation]]
 
-		public SignerInformationStore(
+        /**
+         * Create a store containing a single SignerInformation object.
+         *
+         * @param signerInfo the signer information to contain.
+         */
+        public SignerInformationStore(
+            SignerInformation signerInfo)
+        {
+            this.all = Platform.CreateArrayList(1);
+            this.all.Add(signerInfo);
+
+            SignerID sid = signerInfo.SignerID;
+
+            table[sid] = all;
+        }
+
+        /**
+         * Create a store containing a collection of SignerInformation objects.
+         *
+         * @param signerInfos a collection signer information objects to contain.
+         */
+        public SignerInformationStore(
             ICollection signerInfos)
         {
             foreach (SignerInformation signer in signerInfos)
@@ -19,12 +40,12 @@ namespace Org.BouncyCastle.Cms
                 SignerID sid = signer.SignerID;
                 IList list = (IList)table[sid];
 
-				if (list == null)
-				{
-					table[sid] = list = Platform.CreateArrayList(1);
-				}
+                if (list == null)
+                {
+                    table[sid] = list = Platform.CreateArrayList(1);
+                }
 
-				list.Add(signer);
+                list.Add(signer);
             }
 
             this.all = Platform.CreateArrayList(signerInfos);
@@ -40,24 +61,24 @@ namespace Org.BouncyCastle.Cms
         public SignerInformation GetFirstSigner(
             SignerID selector)
         {
-			IList list = (IList) table[selector];
+            IList list = (IList) table[selector];
 
-			return list == null ? null : (SignerInformation) list[0];
+            return list == null ? null : (SignerInformation) list[0];
         }
 
-		/// <summary>The number of signers in the collection.</summary>
-		public int Count
+        /// <summary>The number of signers in the collection.</summary>
+        public int Count
         {
-			get { return all.Count; }
+            get { return all.Count; }
         }
 
-		/// <returns>An ICollection of all signers in the collection</returns>
+        /// <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.
@@ -66,7 +87,7 @@ namespace Org.BouncyCastle.Cms
         public ICollection GetSigners(
             SignerID selector)
         {
-			IList list = (IList) table[selector];
+            IList list = (IList) table[selector];
 
             return list == null ? Platform.CreateArrayList() : Platform.CreateArrayList(list);
         }