diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/crypto.csproj | 8 | ||||
-rw-r--r-- | crypto/test/UnitTests.csproj | 2 | ||||
-rw-r--r-- | crypto/test/data/cms/sigs/SignedMSPkcs7.sig | bin | 0 -> 4927 bytes | |||
-rw-r--r-- | crypto/test/data/cms/sigs/rawsha256nonull.p7m | bin | 0 -> 1415 bytes | |||
-rw-r--r-- | crypto/test/src/cms/test/SignedDataTest.cs | 18 |
5 files changed, 28 insertions, 0 deletions
diff --git a/crypto/crypto.csproj b/crypto/crypto.csproj index 2f16fa08b..e2ad3ea69 100644 --- a/crypto/crypto.csproj +++ b/crypto/crypto.csproj @@ -7597,6 +7597,14 @@ BuildAction = "EmbeddedResource" /> <File + RelPath = "test\data\cms\sigs\rawsha256nonull.p7m" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "test\data\cms\sigs\SignedMSPkcs7.sig" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "test\data\crypto\SHA3TestVectors.txt" BuildAction = "EmbeddedResource" /> diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj index d4456b9c4..67d3e1b91 100644 --- a/crypto/test/UnitTests.csproj +++ b/crypto/test/UnitTests.csproj @@ -1046,6 +1046,8 @@ <EmbeddedResource Include="data\cms\sigs\PSSSignDataSHA512.sig" /> <EmbeddedResource Include="data\cms\sigs\PSSSignDataSHA512Enc.sig" /> <EmbeddedResource Include="data\cms\sigs\counterSig.p7m" /> + <EmbeddedResource Include="data\cms\sigs\rawsha256nonull.p7m" /> + <EmbeddedResource Include="data\cms\sigs\SignedMSPkcs7.sig" /> <EmbeddedResource Include="data\hc256\hc128\ecrypt_HC-128.txt" /> <EmbeddedResource Include="data\hc256\hc256\ecrypt_HC-256_128K_128IV.txt" /> <EmbeddedResource Include="data\hc256\hc256\ecrypt_HC-256_128K_256IV.txt" /> diff --git a/crypto/test/data/cms/sigs/SignedMSPkcs7.sig b/crypto/test/data/cms/sigs/SignedMSPkcs7.sig new file mode 100644 index 000000000..df9a09b0d --- /dev/null +++ b/crypto/test/data/cms/sigs/SignedMSPkcs7.sig Binary files differdiff --git a/crypto/test/data/cms/sigs/rawsha256nonull.p7m b/crypto/test/data/cms/sigs/rawsha256nonull.p7m new file mode 100644 index 000000000..5d29760cb --- /dev/null +++ b/crypto/test/data/cms/sigs/rawsha256nonull.p7m Binary files differdiff --git a/crypto/test/src/cms/test/SignedDataTest.cs b/crypto/test/src/cms/test/SignedDataTest.cs index 89f7eea7d..29d0464c2 100644 --- a/crypto/test/src/cms/test/SignedDataTest.cs +++ b/crypto/test/src/cms/test/SignedDataTest.cs @@ -672,6 +672,24 @@ namespace Org.BouncyCastle.Cms.Tests VerifySignatures(s, hash); } + [Test] + public void TestRawSha256MissingNull() + { + byte[] document = GetInput("rawsha256nonull.p7m"); + + CmsSignedData s = new CmsSignedData(document); + + IX509Store certStore = s.GetCertificates("Collection"); + foreach (SignerInformation signerInformation in s.GetSignerInfos().GetSigners()) + { + ICollection certCollection = certStore.GetMatches(signerInformation.SignerID); + foreach (X509Certificate cert in certCollection) + { + Assert.IsTrue(signerInformation.Verify(cert), "raw sig failed"); + } + } + } + [Test] public void TestSha1WithRsaEncapsulated() { |