summary refs log tree commit diff
path: root/crypto/src/cms/OriginatorInformation.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-26 20:47:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-26 20:47:24 +0700
commiteed964522f8e198a33267387942b1764018dfe1e (patch)
treec6bcead7e5e54c88845287d10bca6a1235e655e8 /crypto/src/cms/OriginatorInformation.cs
parentCleanup in PQC code (diff)
downloadBouncyCastle.NET-ed25519-eed964522f8e198a33267387942b1764018dfe1e.tar.xz
Replace IX509Store API with new store/selector API
- overhaul Cms, Pkix, X509 APIs
Diffstat (limited to 'crypto/src/cms/OriginatorInformation.cs')
-rw-r--r--crypto/src/cms/OriginatorInformation.cs58
1 files changed, 5 insertions, 53 deletions
diff --git a/crypto/src/cms/OriginatorInformation.cs b/crypto/src/cms/OriginatorInformation.cs
index 618add6e0..7186fafc3 100644
--- a/crypto/src/cms/OriginatorInformation.cs
+++ b/crypto/src/cms/OriginatorInformation.cs
@@ -1,12 +1,8 @@
 using System;
-using System.Collections;
 
-using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Cms;
-using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 using Org.BouncyCastle.X509;
-using Org.BouncyCastle.X509.Store;
 
 namespace Org.BouncyCastle.Cms
 {
@@ -24,31 +20,9 @@ namespace Org.BouncyCastle.Cms
 		*
 		* @return a Store of X509CertificateHolder objects.
 		*/
-		public virtual IX509Store GetCertificates()
+		public virtual IStore<X509Certificate> GetCertificates()
 		{
-			Asn1Set certSet = originatorInfo.Certificates;
-
-			if (certSet != null)
-			{
-				IList certList = Platform.CreateArrayList(certSet.Count);
-
-				foreach (Asn1Encodable enc in certSet)
-				{
-					Asn1Object obj = enc.ToAsn1Object();
-					if (obj is Asn1Sequence)
-					{
-						certList.Add(new X509Certificate(X509CertificateStructure.GetInstance(obj)));
-					}
-				}
-
-				return X509StoreFactory.Create(
-					"Certificate/Collection",
-					new X509CollectionStoreParameters(certList));
-			}
-
-			return X509StoreFactory.Create(
-				"Certificate/Collection",
-				new X509CollectionStoreParameters(Platform.CreateArrayList()));
+			return CmsSignedHelper.Instance.GetCertificates(originatorInfo.Certificates);
 		}
 
 		/**
@@ -56,31 +30,9 @@ namespace Org.BouncyCastle.Cms
 		*
 		* @return a Store of X509CRLHolder objects.
 		*/
-		public virtual IX509Store GetCrls()
+		public virtual IStore<X509Crl> GetCrls()
 		{
-			Asn1Set crlSet = originatorInfo.Certificates;
-
-			if (crlSet != null)
-			{
-                IList crlList = Platform.CreateArrayList(crlSet.Count);
-
-				foreach (Asn1Encodable enc in crlSet)
-				{
-					Asn1Object obj = enc.ToAsn1Object();
-					if (obj is Asn1Sequence)
-					{
-						crlList.Add(new X509Crl(CertificateList.GetInstance(obj)));
-					}
-				}
-
-				return X509StoreFactory.Create(
-					"CRL/Collection",
-					new X509CollectionStoreParameters(crlList));
-			}
-
-			return X509StoreFactory.Create(
-				"CRL/Collection",
-                new X509CollectionStoreParameters(Platform.CreateArrayList()));
+			return CmsSignedHelper.Instance.GetCrls(originatorInfo.Crls);
 		}
 
 		/**