Implement IEnumerable in CMS stores
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();
+ }
}
}
|