summary refs log tree commit diff
path: root/crypto/src/asn1/BEROctetStringGenerator.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@gmail.com>2022-06-16 17:13:48 +0700
committerPeter Dettman <peter.dettman@gmail.com>2022-06-16 17:13:48 +0700
commit49865c2a4ffd91fff774b513f0d6c4f6a7ed4a72 (patch)
treefa963188f0eb5fc08441970a2c0fc8500502b838 /crypto/src/asn1/BEROctetStringGenerator.cs
parentUpdates towards netstandard (diff)
downloadBouncyCastle.NET-ed25519-49865c2a4ffd91fff774b513f0d6c4f6a7ed4a72.tar.xz
Fix PORTABLE build
Diffstat (limited to '')
-rw-r--r--crypto/src/asn1/BEROctetStringGenerator.cs36
1 files changed, 17 insertions, 19 deletions
diff --git a/crypto/src/asn1/BEROctetStringGenerator.cs b/crypto/src/asn1/BEROctetStringGenerator.cs
index bed40b566..7893139d6 100644
--- a/crypto/src/asn1/BEROctetStringGenerator.cs
+++ b/crypto/src/asn1/BEROctetStringGenerator.cs
@@ -108,31 +108,29 @@ namespace Org.BouncyCastle.Asn1
             {
                 if (disposing)
                 {
-				    if (_off != 0)
-				    {
-					    DerOctetString.Encode(_derOut, true, _buf, 0, _off);
-				    }
-
-                    _derOut.FlushInternal();
-
-				    _gen.WriteBerEnd();
+                    ImplClose();
                 }
                 base.Dispose(disposing);
             }
 #else
-			public override void Close()
-			{
-				if (_off != 0)
-				{
-					DerOctetString.Encode(_derOut, _buf, 0, _off);
-				}
+            public override void Close()
+            {
+                ImplClose();
+                base.Close();
+            }
+#endif
+
+            private void ImplClose()
+            {
+                if (_off != 0)
+                {
+                    DerOctetString.Encode(_derOut, _buf, 0, _off);
+                }
 
                 _derOut.FlushInternal();
 
                 _gen.WriteBerEnd();
-				base.Close();
-			}
-#endif
-		}
-	}
+            }
+        }
+    }
 }