summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-24 13:05:28 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-24 13:05:28 +0700
commit215cb54e4f7367ea450195f5678dc3d5d1385008 (patch)
tree295578f282e141713c50e62e8fff363a4b09da1a
parentUse Asn1Set FromVector utility methods (diff)
downloadBouncyCastle.NET-ed25519-215cb54e4f7367ea450195f5678dc3d5d1385008.tar.xz
Implement IEnumerable in CMS stores
-rw-r--r--crypto/src/cms/RecipientInformationStore.cs13
-rw-r--r--crypto/src/cms/SignerInformationStore.cs11
2 files changed, 23 insertions, 1 deletions
diff --git a/crypto/src/cms/RecipientInformationStore.cs b/crypto/src/cms/RecipientInformationStore.cs
index 281b51c79..e317bc381 100644
--- a/crypto/src/cms/RecipientInformationStore.cs
+++ b/crypto/src/cms/RecipientInformationStore.cs
@@ -6,6 +6,7 @@ using Org.BouncyCastle.Utilities;
 namespace Org.BouncyCastle.Cms
 {
 	public class RecipientInformationStore
+		: IEnumerable<RecipientInformation>
 	{
 		private readonly IList<RecipientInformation> m_all;
 		private readonly IDictionary<RecipientID, IList<RecipientInformation>> m_table =
@@ -81,5 +82,15 @@ namespace Org.BouncyCastle.Cms
 
 			return new List<RecipientInformation>(list);
 		}
-	}
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public virtual IEnumerator<RecipientInformation> GetEnumerator()
+        {
+            return GetRecipients().GetEnumerator();
+        }
+    }
 }
diff --git a/crypto/src/cms/SignerInformationStore.cs b/crypto/src/cms/SignerInformationStore.cs
index bc21f9d39..00919c221 100644
--- a/crypto/src/cms/SignerInformationStore.cs
+++ b/crypto/src/cms/SignerInformationStore.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 namespace Org.BouncyCastle.Cms
 {
     public class SignerInformationStore
+        : IEnumerable<SignerInformation>
     {
         private readonly IList<SignerInformation> m_all;
         private readonly IDictionary<SignerID, IList<SignerInformation>> m_table =
@@ -87,5 +88,15 @@ namespace Org.BouncyCastle.Cms
 
             return new List<SignerInformation>(0);
         }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public virtual IEnumerator<SignerInformation> GetEnumerator()
+        {
+            return GetSigners().GetEnumerator();
+        }
     }
 }