diff options
author | mw <megan@cryptoworkshop.com> | 2021-09-03 14:35:32 +1000 |
---|---|---|
committer | mw <megan@cryptoworkshop.com> | 2021-09-03 14:35:32 +1000 |
commit | 33c6a78371a5f6789c36186d7b89576a7c19d942 (patch) | |
tree | 98b77aee1360d479ece0de5642b82c8ad67a47d4 /crypto/test/src/util | |
parent | moved test (diff) | |
download | BouncyCastle.NET-ed25519-33c6a78371a5f6789c36186d7b89576a7c19d942.tar.xz |
Updated PemReader to support differing whitespace assumptions.
Added tests. Issue #2
Diffstat (limited to 'crypto/test/src/util')
-rw-r--r-- | crypto/test/src/util/io/pem/test/AllTests.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/test/src/util/io/pem/test/AllTests.cs b/crypto/test/src/util/io/pem/test/AllTests.cs index c0ca667f5..2eea7221c 100644 --- a/crypto/test/src/util/io/pem/test/AllTests.cs +++ b/crypto/test/src/util/io/pem/test/AllTests.cs @@ -66,9 +66,17 @@ namespace Org.BouncyCastle.Utilities.IO.Pem.Tests [Test] public void TestMalformed() { - PemReader rd = new PemReader(new StringReader("-----BEGIN \n")); + try + { + PemReader rd = new PemReader(new StringReader("-----BEGIN \n")); + rd.ReadPemObject(); + Assert.Fail("must fail on malformed"); + } catch (IOException ioex) + { + Assert.AreEqual("ran out of data before consuming type", ioex.Message); + } - Assert.IsNull(rd.ReadPemObject()); + } private void lengthTest(string type, IList headers, byte[] data) |