summary refs log tree commit diff
path: root/crypto/test/src/tls
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 01:13:27 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 01:13:27 +0700
commita8a17fd70fc8df3ca7402323ad5c4f36b25cb806 (patch)
tree9b276b62885505abbb899d17744b65b912072140 /crypto/test/src/tls
parentPrimes improvements (diff)
downloadBouncyCastle.NET-ed25519-a8a17fd70fc8df3ca7402323ad5c4f36b25cb806.tar.xz
Dispose cleanup
- IDisposable for PemReader, PemWriter, IStreamGenerator
Diffstat (limited to 'crypto/test/src/tls')
-rw-r--r--crypto/test/src/tls/test/TlsTestUtilities.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/test/src/tls/test/TlsTestUtilities.cs b/crypto/test/src/tls/test/TlsTestUtilities.cs
index a3526ab6b..3baf233c7 100644
--- a/crypto/test/src/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/tls/test/TlsTestUtilities.cs
@@ -371,13 +371,12 @@ namespace Org.BouncyCastle.Tls.Tests
         }
 
         internal static PemObject LoadPemResource(string resource)
-           
         {
             Stream s = SimpleTest.GetTestDataAsStream("tls." + resource);
-            PemReader p = new PemReader(new StreamReader(s));
-            PemObject o = p.ReadPemObject();
-            p.Reader.Close();
-            return o;
+            using (var p = new PemReader(new StreamReader(s)))
+            {
+                return p.ReadPemObject();
+            }
         }
 
         internal static bool AreSameCertificate(TlsCrypto crypto, TlsCertificate cert, string resource)