summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-09-17 17:37:25 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-09-17 17:37:25 +0700
commitb90398d12fa57868910ab10566cd0f27cdd99aba (patch)
tree7f8d35212d0decbb399f47cfad6b4b0993a0fd24 /crypto/test
parentAdd new PGP signature testcase (diff)
downloadBouncyCastle.NET-ed25519-b90398d12fa57868910ab10566cd0f27cdd99aba.tar.xz
Add testcase for RAW PKCS#1 signatures missing DER NULL
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/UnitTests.csproj2
-rw-r--r--crypto/test/data/cms/sigs/SignedMSPkcs7.sigbin0 -> 4927 bytes
-rw-r--r--crypto/test/data/cms/sigs/rawsha256nonull.p7mbin0 -> 1415 bytes
-rw-r--r--crypto/test/src/cms/test/SignedDataTest.cs18
4 files changed, 20 insertions, 0 deletions
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() {