Skip to content

Commit 2601f27

Browse files
decommission cryptography
1 parent 22df014 commit 2601f27

File tree

9 files changed

+14
-44
lines changed

9 files changed

+14
-44
lines changed

src/UiPath.CoreIpc/Client/ClientConnectionsRegistry.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ internal static ClientConnection Remove(IConnectionKey connectionKey)
3535
}
3636
interface IConnectionKey : IEquatable<IConnectionKey>
3737
{
38-
string SslServer { get; }
3938
ClientConnection CreateClientConnection();
4039
}
4140
abstract class ClientConnection : IDisposable

src/UiPath.CoreIpc/Client/ServiceClient.cs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ class ServiceClient<TInterface> : IServiceClient, IConnectionKey where TInterfac
2424
private Server _server;
2525
private ClientConnection _clientConnection;
2626

27-
internal ServiceClient(ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, string sslServer = null, BeforeCallHandler beforeCall = null, EndpointSettings serviceEndpoint = null)
27+
internal ServiceClient(ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, BeforeCallHandler beforeCall = null, EndpointSettings serviceEndpoint = null)
2828
{
2929
_serializer = serializer;
3030
_requestTimeout = requestTimeout;
3131
_logger = logger;
3232
_connectionFactory = connectionFactory;
33-
SslServer = sslServer;
3433
_beforeCall = beforeCall;
3534
_serviceEndpoint = serviceEndpoint;
3635
}
3736
protected int HashCode { get; init; }
38-
public string SslServer { get; init; }
3937
public virtual string Name => _connection?.Name;
4038
private bool LogEnabled => _logger.Enabled();
4139
Connection IServiceClient.Connection => _connection;
@@ -190,9 +188,8 @@ private async Task<bool> Connect(CancellationToken cancellationToken)
190188
{
191189
clientConnection.Dispose();
192190
throw;
193-
}
194-
var stream = SslServer == null ? network : await AuthenticateAsClient(network);
195-
OnNewConnection(new(stream, _serializer, _logger, Name));
191+
}
192+
OnNewConnection(new(network, _serializer, _logger, Name));
196193
if (LogEnabled)
197194
{
198195
Log($"CreateConnection {Name}.");
@@ -204,21 +201,6 @@ private async Task<bool> Connect(CancellationToken cancellationToken)
204201
clientConnection.Release();
205202
}
206203
return true;
207-
async Task<Stream> AuthenticateAsClient(Stream network)
208-
{
209-
var sslStream = new SslStream(network);
210-
try
211-
{
212-
await sslStream.AuthenticateAsClientAsync(SslServer);
213-
}
214-
catch
215-
{
216-
sslStream.Dispose();
217-
throw;
218-
}
219-
Debug.Assert(sslStream.IsEncrypted && sslStream.IsSigned);
220-
return sslStream;
221-
}
222204
}
223205

224206
private void ReuseClientConnection(ClientConnection clientConnection)
@@ -276,7 +258,7 @@ protected virtual void Dispose(bool disposing)
276258

277259
public override string ToString() => Name;
278260

279-
public virtual bool Equals(IConnectionKey other) => SslServer == other.SslServer;
261+
public virtual bool Equals(IConnectionKey other) => true;
280262

281263
public virtual ClientConnection CreateClientConnection() => throw new NotImplementedException();
282264
}

src/UiPath.CoreIpc/Client/ServiceClientBuilder.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public abstract class ServiceClientBuilder<TDerived, TInterface> where TInterfac
1313
protected BeforeCallHandler _beforeCall;
1414
protected object _callbackInstance;
1515
protected TaskScheduler _taskScheduler;
16-
protected string _sslServer;
1716

1817
protected ServiceClientBuilder(Type callbackContract, IServiceProvider serviceProvider)
1918
{
@@ -31,16 +30,6 @@ public TDerived ConnectionFactory(ConnectionFactory connectionFactory)
3130
return (TDerived)this;
3231
}
3332

34-
public TDerived EncryptAndSign(string certificateServerName)
35-
{
36-
if (string.IsNullOrWhiteSpace(certificateServerName))
37-
{
38-
throw new ArgumentException($"'{nameof(certificateServerName)}' must match the name on the server's certificate.", nameof(certificateServerName));
39-
}
40-
_sslServer = certificateServerName;
41-
return (TDerived)this;
42-
}
43-
4433
public TDerived BeforeCall(BeforeCallHandler beforeCall)
4534
{
4635
_beforeCall = beforeCall;

src/UiPath.CoreIpc/NamedPipe/NamedPipeClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ interface INamedPipeKey : IConnectionKey
1515

1616
class NamedPipeClient<TInterface> : ServiceClient<TInterface>, INamedPipeKey where TInterface : class
1717
{
18-
public NamedPipeClient(string serverName, string pipeName, ISerializer serializer, TimeSpan requestTimeout, bool allowImpersonation, ILogger logger, ConnectionFactory connectionFactory, string sslServer, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint)
19-
: base(serializer, requestTimeout, logger, connectionFactory, sslServer, beforeCall, serviceEndpoint)
18+
public NamedPipeClient(string serverName, string pipeName, ISerializer serializer, TimeSpan requestTimeout, bool allowImpersonation, ILogger logger, ConnectionFactory connectionFactory, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint)
19+
: base(serializer, requestTimeout, logger, connectionFactory, beforeCall, serviceEndpoint)
2020
{
2121
ServerName = serverName;
2222
PipeName = pipeName;
2323
AllowImpersonation = allowImpersonation;
24-
HashCode = (serverName, pipeName, allowImpersonation, sslServer).GetHashCode();
24+
HashCode = (serverName, pipeName, allowImpersonation).GetHashCode();
2525
}
2626
public override string Name => base.Name ?? PipeName;
2727
public string ServerName { get; }

src/UiPath.CoreIpc/NamedPipe/NamedPipeClientBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public TDerived AllowImpersonation()
2727
}
2828

2929
protected override TInterface BuildCore(EndpointSettings serviceEndpoint) =>
30-
new NamedPipeClient<TInterface>(_serverName, _pipeName, _serializer, _requestTimeout, _allowImpersonation, _logger, _connectionFactory, _sslServer, _beforeCall, serviceEndpoint).CreateProxy();
30+
new NamedPipeClient<TInterface>(_serverName, _pipeName, _serializer, _requestTimeout, _allowImpersonation, _logger, _connectionFactory, _beforeCall, serviceEndpoint).CreateProxy();
3131
}
3232

3333
public class NamedPipeClientBuilder<TInterface> : NamedPipeClientBuilderBase<NamedPipeClientBuilder<TInterface>, TInterface> where TInterface : class

src/UiPath.CoreIpc/Tcp/TcpClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ interface ITcpKey : IConnectionKey
1111
}
1212
class TcpClient<TInterface> : ServiceClient<TInterface>, ITcpKey where TInterface : class
1313
{
14-
public TcpClient(IPEndPoint endPoint, ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, string sslServer, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint) : base(serializer, requestTimeout, logger, connectionFactory, sslServer, beforeCall, serviceEndpoint)
14+
public TcpClient(IPEndPoint endPoint, ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint) : base(serializer, requestTimeout, logger, connectionFactory, beforeCall, serviceEndpoint)
1515
{
1616
EndPoint = endPoint;
17-
HashCode = (EndPoint, sslServer).GetHashCode();
17+
HashCode = EndPoint.GetHashCode();
1818
}
1919
public override string Name => base.Name ?? EndPoint.ToString();
2020
public IPEndPoint EndPoint { get; }

src/UiPath.CoreIpc/Tcp/TcpClientBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ protected TcpClientBuilderBase(IPEndPoint endPoint, Type callbackContract = null
1010
_endPoint = endPoint;
1111

1212
protected override TInterface BuildCore(EndpointSettings serviceEndpoint) =>
13-
new TcpClient<TInterface>(_endPoint, _serializer, _requestTimeout, _logger, _connectionFactory, _sslServer, _beforeCall, serviceEndpoint).CreateProxy();
13+
new TcpClient<TInterface>(_endPoint, _serializer, _requestTimeout, _logger, _connectionFactory, _beforeCall, serviceEndpoint).CreateProxy();
1414
}
1515

1616
public class TcpClientBuilder<TInterface> : TcpClientBuilderBase<TcpClientBuilder<TInterface>, TInterface> where TInterface : class

src/UiPath.CoreIpc/WebSockets/WebSocketClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ interface IWebSocketsKey : IConnectionKey
88
}
99
class WebSocketClient<TInterface> : ServiceClient<TInterface>, IWebSocketsKey where TInterface : class
1010
{
11-
public WebSocketClient(Uri uri, ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, string sslServer, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint) : base(serializer, requestTimeout, logger, connectionFactory, sslServer, beforeCall, serviceEndpoint)
11+
public WebSocketClient(Uri uri, ISerializer serializer, TimeSpan requestTimeout, ILogger logger, ConnectionFactory connectionFactory, BeforeCallHandler beforeCall, EndpointSettings serviceEndpoint) : base(serializer, requestTimeout, logger, connectionFactory, beforeCall, serviceEndpoint)
1212
{
1313
Uri = uri;
14-
HashCode = (uri, sslServer).GetHashCode();
14+
HashCode = uri.GetHashCode();
1515
}
1616
public override string Name => base.Name ?? Uri.ToString();
1717
public Uri Uri { get; }

src/UiPath.CoreIpc/WebSockets/WebSocketClientBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public abstract class WebSocketClientBuilderBase<TDerived, TInterface> : Service
55
protected WebSocketClientBuilderBase(Uri uri, Type callbackContract = null, IServiceProvider serviceProvider = null) : base(callbackContract, serviceProvider) =>
66
_uri = uri;
77
protected override TInterface BuildCore(EndpointSettings serviceEndpoint) =>
8-
new WebSocketClient<TInterface>(_uri, _serializer, _requestTimeout, _logger, _connectionFactory, _sslServer, _beforeCall, serviceEndpoint).CreateProxy();
8+
new WebSocketClient<TInterface>(_uri, _serializer, _requestTimeout, _logger, _connectionFactory, _beforeCall, serviceEndpoint).CreateProxy();
99
}
1010
public class WebSocketClientBuilder<TInterface> : WebSocketClientBuilderBase<WebSocketClientBuilder<TInterface>, TInterface> where TInterface : class
1111
{

0 commit comments

Comments
 (0)