summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 20:06:41 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 20:06:41 +0700
commit90076c81bd0110c75678fe3c4c958dcec5d3daba (patch)
tree9dee8e73b79f5b708b829db5e24a9886393f1db6 /crypto/test
parentUpdate GCMBlockCipher from Java API (diff)
downloadBouncyCastle.NET-ed25519-90076c81bd0110c75678fe3c4c958dcec5d3daba.tar.xz
Stop decoding exceptions escaping from GetDecoderStream
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/openpgp/test/PGPArmoredTest.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crypto/test/src/openpgp/test/PGPArmoredTest.cs b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
index aa13477ed..e48827a35 100644
--- a/crypto/test/src/openpgp/test/PGPArmoredTest.cs
+++ b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
@@ -87,6 +87,22 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			return matches;
 		}
 
+        private void pgpUtilTest()
+        {
+            // check decoder exception isn't escaping.
+            MemoryStream bIn = new MemoryStream(Strings.ToByteArray("abcde"), false);
+
+            try
+            {
+                PgpUtilities.GetDecoderStream(bIn);
+                Fail("no exception");
+            }
+            catch (IOException)
+            {
+                // expected: ignore.
+            }
+        }
+
 		private void blankLineTest()
 		{
 			byte[] blankLineBytes = Encoding.ASCII.GetBytes(blankLineData);
@@ -241,6 +257,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			}
 
 			blankLineTest();
+            pgpUtilTest();
 		}
 
 		public override string Name