summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 22:28:24 +1030
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 22:28:24 +1030
commit511a6af913f64908ada0ad8aeb19fd7a8f7e9575 (patch)
treed90af4ce8482cb4ec2ad8e2d6f9639635081d104 /crypto
parentChange TLS server default DH parameters to 2048-bit group from RFC 3526 (diff)
downloadBouncyCastle.NET-ed25519-511a6af913f64908ada0ad8aeb19fd7a8f7e9575.tar.xz
Simple refactoring to follow bc-java code
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/tls/CertificateUrl.cs3
-rw-r--r--crypto/src/crypto/tls/DigestInputBuffer.cs4
-rw-r--r--crypto/src/crypto/tls/OcspStatusRequest.cs3
-rw-r--r--crypto/src/crypto/tls/ServerNameList.cs3
-rw-r--r--crypto/src/crypto/tls/SignerInputBuffer.cs4
-rw-r--r--crypto/src/util/io/Streams.cs8
6 files changed, 15 insertions, 10 deletions
diff --git a/crypto/src/crypto/tls/CertificateUrl.cs b/crypto/src/crypto/tls/CertificateUrl.cs
index d285fa0f6..aff999551 100644
--- a/crypto/src/crypto/tls/CertificateUrl.cs
+++ b/crypto/src/crypto/tls/CertificateUrl.cs
@@ -3,6 +3,7 @@ using System.Collections;
 using System.IO;
 
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
 {
@@ -116,7 +117,7 @@ namespace Org.BouncyCastle.Crypto.Tls
                 TlsUtilities.CheckUint16(length);
                 this.Position = 0;
                 TlsUtilities.WriteUint16((int)length, this);
-                this.WriteTo(output);
+                Streams.WriteBufTo(this, output);
                 Platform.Dispose(this);
             }
         }
diff --git a/crypto/src/crypto/tls/DigestInputBuffer.cs b/crypto/src/crypto/tls/DigestInputBuffer.cs
index 547bcab54..4435b40a5 100644
--- a/crypto/src/crypto/tls/DigestInputBuffer.cs
+++ b/crypto/src/crypto/tls/DigestInputBuffer.cs
@@ -1,8 +1,6 @@
 using System;
 using System.IO;
 
-using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Crypto.IO;
 using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
@@ -12,7 +10,7 @@ namespace Org.BouncyCastle.Crypto.Tls
     {
         internal void UpdateDigest(IDigest d)
         {
-            WriteTo(new DigStream(d));
+            Streams.WriteBufTo(this, new DigStream(d));
         }
 
         private class DigStream
diff --git a/crypto/src/crypto/tls/OcspStatusRequest.cs b/crypto/src/crypto/tls/OcspStatusRequest.cs
index 2dd8371e5..d9203a3c4 100644
--- a/crypto/src/crypto/tls/OcspStatusRequest.cs
+++ b/crypto/src/crypto/tls/OcspStatusRequest.cs
@@ -6,6 +6,7 @@ using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
 {
@@ -71,7 +72,7 @@ namespace Org.BouncyCastle.Crypto.Tls
                 }
                 TlsUtilities.CheckUint16(buf.Length);
                 TlsUtilities.WriteUint16((int)buf.Length, output);
-                buf.WriteTo(output);
+                Streams.WriteBufTo(buf, output);
             }
 
             if (mRequestExtensions == null)
diff --git a/crypto/src/crypto/tls/ServerNameList.cs b/crypto/src/crypto/tls/ServerNameList.cs
index 5b5b90e58..ed4e59359 100644
--- a/crypto/src/crypto/tls/ServerNameList.cs
+++ b/crypto/src/crypto/tls/ServerNameList.cs
@@ -3,6 +3,7 @@ using System.Collections;
 using System.IO;
 
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
 {
@@ -52,7 +53,7 @@ namespace Org.BouncyCastle.Crypto.Tls
 
             TlsUtilities.CheckUint16(buf.Length);
             TlsUtilities.WriteUint16((int)buf.Length, output);
-            buf.WriteTo(output);
+            Streams.WriteBufTo(buf, output);
         }
 
         /**
diff --git a/crypto/src/crypto/tls/SignerInputBuffer.cs b/crypto/src/crypto/tls/SignerInputBuffer.cs
index ef2827c4d..7bc69624c 100644
--- a/crypto/src/crypto/tls/SignerInputBuffer.cs
+++ b/crypto/src/crypto/tls/SignerInputBuffer.cs
@@ -1,8 +1,6 @@
 using System;
 using System.IO;
 
-using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Crypto.IO;
 using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
@@ -12,7 +10,7 @@ namespace Org.BouncyCastle.Crypto.Tls
     {
         internal void UpdateSigner(ISigner s)
         {
-            WriteTo(new SigStream(s));
+            Streams.WriteBufTo(this, new SigStream(s));
         }
 
         private class SigStream
diff --git a/crypto/src/util/io/Streams.cs b/crypto/src/util/io/Streams.cs
index 70957acc7..cc7fa924c 100644
--- a/crypto/src/util/io/Streams.cs
+++ b/crypto/src/util/io/Streams.cs
@@ -90,5 +90,11 @@ namespace Org.BouncyCastle.Utilities.IO
 			}
 			return total;
 		}
-	}
+
+        /// <exception cref="IOException"></exception>
+        public static void WriteBufTo(MemoryStream buf, Stream output)
+        {
+            buf.WriteTo(output);
+        }
+    }
 }