summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-12-21 19:47:41 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-12-21 19:47:41 +0700
commit2e91027902f5293f34127b787aa5de74f6849a4f (patch)
treeadd8ae30860179282678ebc36d365ab50390dfae /crypto/test
parentCheck CertificateRequest syntax server-side (diff)
downloadBouncyCastle.NET-ed25519-2e91027902f5293f34127b787aa5de74f6849a4f.tar.xz
BJA-584 Fix DTLS record-layer version handling
- Also https://github.com/bcgit/bc-java/pull/111
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/crypto/tls/test/DtlsTestSuite.cs11
-rw-r--r--crypto/test/src/crypto/tls/test/MockDtlsClient.cs9
-rw-r--r--crypto/test/src/crypto/tls/test/MockTlsClient.cs9
3 files changed, 15 insertions, 14 deletions
diff --git a/crypto/test/src/crypto/tls/test/DtlsTestSuite.cs b/crypto/test/src/crypto/tls/test/DtlsTestSuite.cs
index e9e4411af..a1ba62dde 100644
--- a/crypto/test/src/crypto/tls/test/DtlsTestSuite.cs
+++ b/crypto/test/src/crypto/tls/test/DtlsTestSuite.cs
@@ -203,11 +203,6 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
 
         private static void AddTestCase(IList testSuite, TlsTestConfig config, String name)
         {
-            //testSuite.Add(new TestCaseData(config).SetName(name));
-        }
-
-        private static void AddTestCaseDebug(IList testSuite, TlsTestConfig config, String name)
-        {
             testSuite.Add(new TestCaseData(config).SetName(name));
         }
 
@@ -215,11 +210,7 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
         {
             TlsTestConfig c = new TlsTestConfig();
             c.clientMinimumVersion = ProtocolVersion.DTLSv10;
-            /*
-             * TODO We'd like to just set the offer version to DTLSv12, but there is a known issue with
-             * overly-restrictive version checks b/w BC DTLS 1.2 client, BC DTLS 1.0 server
-             */
-            c.clientOfferVersion = version;
+            c.clientOfferVersion = ProtocolVersion.DTLSv12;
             c.serverMaximumVersion = version;
             c.serverMinimumVersion = ProtocolVersion.DTLSv10;
             return c;
diff --git a/crypto/test/src/crypto/tls/test/MockDtlsClient.cs b/crypto/test/src/crypto/tls/test/MockDtlsClient.cs
index e3c604db7..25057b8ce 100644
--- a/crypto/test/src/crypto/tls/test/MockDtlsClient.cs
+++ b/crypto/test/src/crypto/tls/test/MockDtlsClient.cs
@@ -73,8 +73,13 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
             IDictionary clientExtensions = TlsExtensionsUtilities.EnsureExtensionsInitialised(base.GetClientExtensions());
             TlsExtensionsUtilities.AddEncryptThenMacExtension(clientExtensions);
             TlsExtensionsUtilities.AddExtendedMasterSecretExtension(clientExtensions);
-            TlsExtensionsUtilities.AddMaxFragmentLengthExtension(clientExtensions, MaxFragmentLength.pow2_9);
-            TlsExtensionsUtilities.AddTruncatedHMacExtension(clientExtensions);
+            {
+                /*
+                 * NOTE: If you are copying test code, do not blindly set these extensions in your own client.
+                 */
+                TlsExtensionsUtilities.AddMaxFragmentLengthExtension(clientExtensions, MaxFragmentLength.pow2_9);
+                TlsExtensionsUtilities.AddTruncatedHMacExtension(clientExtensions);
+            }
             return clientExtensions;
         }
 
diff --git a/crypto/test/src/crypto/tls/test/MockTlsClient.cs b/crypto/test/src/crypto/tls/test/MockTlsClient.cs
index 7c1198632..35c5b3599 100644
--- a/crypto/test/src/crypto/tls/test/MockTlsClient.cs
+++ b/crypto/test/src/crypto/tls/test/MockTlsClient.cs
@@ -63,8 +63,13 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
             IDictionary clientExtensions = TlsExtensionsUtilities.EnsureExtensionsInitialised(base.GetClientExtensions());
             TlsExtensionsUtilities.AddEncryptThenMacExtension(clientExtensions);
             TlsExtensionsUtilities.AddExtendedMasterSecretExtension(clientExtensions);
-            TlsExtensionsUtilities.AddMaxFragmentLengthExtension(clientExtensions, MaxFragmentLength.pow2_9);
-            TlsExtensionsUtilities.AddTruncatedHMacExtension(clientExtensions);
+            {
+                /*
+                 * NOTE: If you are copying test code, do not blindly set these extensions in your own client.
+                 */
+                TlsExtensionsUtilities.AddMaxFragmentLengthExtension(clientExtensions, MaxFragmentLength.pow2_9);
+                TlsExtensionsUtilities.AddTruncatedHMacExtension(clientExtensions);
+            }
             return clientExtensions;
         }