From 893a7ef027197c5c41ff7f60341fc661b36550d5 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 5 May 2022 22:28:11 +0700 Subject: Fix tests for stream signers --- crypto/test/src/tls/test/TlsTestClientImpl.cs | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'crypto/test/src/tls') 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()); + } + } } } -- cgit 1.4.1