summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-05 22:28:11 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-05 22:28:11 +0700
commit893a7ef027197c5c41ff7f60341fc661b36550d5 (patch)
treede08e25514d405e6983415060adf4f2f57db682d /crypto
parentRework TLS 1.3 verifiers (diff)
downloadBouncyCastle.NET-ed25519-893a7ef027197c5c41ff7f60341fc661b36550d5.tar.xz
Fix tests for stream signers
Diffstat (limited to 'crypto')
-rw-r--r--crypto/test/src/tls/test/TlsTestClientImpl.cs32
1 files changed, 30 insertions, 2 deletions
diff --git a/crypto/test/src/tls/test/TlsTestClientImpl.cs b/crypto/test/src/tls/test/TlsTestClientImpl.cs
index 8f878eeb8..04c8ad0af 100644
--- a/crypto/test/src/tls/test/TlsTestClientImpl.cs
+++ b/crypto/test/src/tls/test/TlsTestClientImpl.cs
@@ -372,8 +372,36 @@ namespace Org.BouncyCastle.Tls.Tests
 
             public virtual TlsStreamSigner GetStreamSigner()
             {
-                return null;
+                TlsStreamSigner streamSigner = m_inner.GetStreamSigner();
+
+                if (streamSigner != null && m_outer.m_config.clientAuth == TlsTestConfig.CLIENT_AUTH_INVALID_VERIFY)
+                    return new CorruptingStreamSigner(m_outer, streamSigner);
+
+                return streamSigner;
             }
-        };
+        }
+
+        internal class CorruptingStreamSigner
+            : TlsStreamSigner
+        {
+            private readonly TlsTestClientImpl m_outer;
+            private readonly TlsStreamSigner m_inner;
+
+            internal CorruptingStreamSigner(TlsTestClientImpl outer, TlsStreamSigner inner)
+            {
+                this.m_outer = outer;
+                this.m_inner = inner;
+            }
+
+            public Stream Stream
+            {
+                get { return m_inner.Stream; }
+            }
+
+            public byte[] GetSignature()
+            {
+                return m_outer.CorruptBit(m_inner.GetSignature());
+            }
+        }
     }
 }