summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-08-06 17:58:23 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-08-06 17:58:23 +0700
commitc5c97a3d43047a45c137ac061ac9dcdc95256131 (patch)
tree4b6ef5d7545a404ed0ef16294608c7396d75db79 /crypto
parentAdd IgnoreX509NameOrdering property (diff)
downloadBouncyCastle.NET-ed25519-c5c97a3d43047a45c137ac061ac9dcdc95256131.tar.xz
Add UseDerForCerts, UseDerForCrls properties
- see https://github.com/bcgit/bc-csharp/pull/101
Diffstat (limited to '')
-rw-r--r--crypto/src/cms/CMSSignedDataGenerator.cs10
-rw-r--r--crypto/src/cms/CMSSignedDataStreamGenerator.cs8
-rw-r--r--crypto/src/cms/CMSSignedGenerator.cs14
3 files changed, 27 insertions, 5 deletions
diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs
index f63ed874e..5aa5f92ab 100644
--- a/crypto/src/cms/CMSSignedDataGenerator.cs
+++ b/crypto/src/cms/CMSSignedDataGenerator.cs
@@ -513,15 +513,19 @@ namespace Org.BouncyCastle.Cms
 
 			if (_certs.Count != 0)
 			{
-				certificates = CmsUtilities.CreateBerSetFromList(_certs);
+				certificates = UseDerForCerts
+                    ?   CmsUtilities.CreateDerSetFromList(_certs)
+                    :   CmsUtilities.CreateBerSetFromList(_certs);
 			}
 
 			Asn1Set certrevlist = null;
 
 			if (_crls.Count != 0)
 			{
-				certrevlist = CmsUtilities.CreateBerSetFromList(_crls);
-			}
+                certrevlist = UseDerForCrls
+                    ?   CmsUtilities.CreateDerSetFromList(_crls)
+                    :   CmsUtilities.CreateBerSetFromList(_crls);
+            }
 
 			Asn1OctetString octs = null;
 			if (encapsulate)
diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs
index d0ab7428a..1cea087f3 100644
--- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs
@@ -838,14 +838,18 @@ namespace Org.BouncyCastle.Cms
 
 				if (outer._certs.Count > 0)
 				{
-					Asn1Set certs = CmsUtilities.CreateBerSetFromList(outer._certs);
+					Asn1Set certs = outer.UseDerForCerts
+                        ?   CmsUtilities.CreateDerSetFromList(outer._certs)
+                        :   CmsUtilities.CreateBerSetFromList(outer._certs);
 
 					WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs));
 				}
 
 				if (outer._crls.Count > 0)
 				{
-					Asn1Set crls = CmsUtilities.CreateBerSetFromList(outer._crls);
+                    Asn1Set crls = outer.UseDerForCrls
+                        ?   CmsUtilities.CreateDerSetFromList(outer._crls)
+                        :   CmsUtilities.CreateBerSetFromList(outer._crls);
 
 					WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls));
 				}
diff --git a/crypto/src/cms/CMSSignedGenerator.cs b/crypto/src/cms/CMSSignedGenerator.cs
index eec2e875b..249d70499 100644
--- a/crypto/src/cms/CMSSignedGenerator.cs
+++ b/crypto/src/cms/CMSSignedGenerator.cs
@@ -147,6 +147,8 @@ namespace Org.BouncyCastle.Cms
         internal IList _crls = Platform.CreateArrayList();
         internal IList _signers = Platform.CreateArrayList();
         internal IDictionary _digests = Platform.CreateHashtable();
+        internal bool _useDerForCerts = false;
+        internal bool _useDerForCrls = false;
 
         protected readonly SecureRandom rand;
 
@@ -251,6 +253,18 @@ namespace Org.BouncyCastle.Cms
             return Platform.CreateHashtable(_digests);
         }
 
+        public bool UseDerForCerts
+        {
+            get { return _useDerForCerts; }
+            set { this._useDerForCerts = value; }
+        }
+
+        public bool UseDerForCrls
+        {
+            get { return _useDerForCrls; }
+            set { this._useDerForCrls = value; }
+        }
+
         internal virtual void AddSignerCallback(
             SignerInformation si)
         {