diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-11-10 16:55:34 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-11-10 16:55:34 +0700 |
commit | 867bd8fe661c466e0a38678e4612c08fa4e032e0 (patch) | |
tree | d50b3c0024f9e4cda429957e3263890e39e518ec | |
parent | Port from Java of improvements to DerBoolean and DerEnumerated (diff) | |
download | BouncyCastle.NET-ed25519-867bd8fe661c466e0a38678e4612c08fa4e032e0.tar.xz |
Don't require there to be any digests, to allow in particular for a certs-only SignedData
-rw-r--r-- | crypto/src/cms/CMSSignedDataParser.cs | 5 | ||||
-rw-r--r-- | crypto/test/src/cms/test/SignedDataStreamTest.cs | 20 |
2 files changed, 20 insertions, 5 deletions
diff --git a/crypto/src/cms/CMSSignedDataParser.cs b/crypto/src/cms/CMSSignedDataParser.cs index 35a125196..e5674a4cf 100644 --- a/crypto/src/cms/CMSSignedDataParser.cs +++ b/crypto/src/cms/CMSSignedDataParser.cs @@ -170,11 +170,6 @@ namespace Org.BouncyCastle.Cms { throw new CmsException("io exception: " + e.Message, e); } - - if (_digests.Count < 1) - { - throw new CmsException("no digests could be created for message."); - } } /** diff --git a/crypto/test/src/cms/test/SignedDataStreamTest.cs b/crypto/test/src/cms/test/SignedDataStreamTest.cs index 29b0db8f4..96f3f125d 100644 --- a/crypto/test/src/cms/test/SignedDataStreamTest.cs +++ b/crypto/test/src/cms/test/SignedDataStreamTest.cs @@ -1211,5 +1211,25 @@ namespace Org.BouncyCastle.Cms.Tests Assert.AreEqual(SignCert, a[0]); Assert.AreEqual(OrigCert, a[1]); } + + [Test] + public void TestCertsOnly() + { + IList certList = new ArrayList(); + certList.Add(OrigCert); + certList.Add(SignCert); + + IX509Store x509Certs = X509StoreFactory.Create( + "Certificate/Collection", + new X509CollectionStoreParameters(certList)); + + MemoryStream bOut = new MemoryStream(); + + CmsSignedDataStreamGenerator gen = new CmsSignedDataStreamGenerator(); + gen.AddCertificates(x509Certs); + gen.Open(bOut).Close(); + + CheckSigParseable(bOut.ToArray()); + } } } |