Updated to support .net standard 2.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net48; net8.0</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0; net48; net8.0</TargetFrameworks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -200,10 +200,17 @@ namespace EonaCat.Connections.Helpers
|
|||||||
|
|
||||||
private static byte[] DeriveKey(string password, byte[] salt, int size)
|
private static byte[] DeriveKey(string password, byte[] salt, int size)
|
||||||
{
|
{
|
||||||
|
#if NET472_OR_GREATER || NET8_0_OR_GREATER
|
||||||
using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, _iterations, HashAlgorithmName.SHA256))
|
using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, _iterations, HashAlgorithmName.SHA256))
|
||||||
{
|
{
|
||||||
return pbkdf2.GetBytes(size);
|
return pbkdf2.GetBytes(size);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, _iterations))
|
||||||
|
{
|
||||||
|
return pbkdf2.GetBytes(size);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] RandomBytes(int total)
|
private static byte[] RandomBytes(int total)
|
||||||
|
|||||||
@@ -541,14 +541,14 @@ namespace EonaCat.Connections
|
|||||||
sslDiagnostics?.StartStage("ClientAuth");
|
sslDiagnostics?.StartStage("ClientAuth");
|
||||||
if (_config.Certificate != null)
|
if (_config.Certificate != null)
|
||||||
{
|
{
|
||||||
await sslStream.AuthenticateAsClientAsync(_config.Host, new X509CertificateCollection { _config.Certificate }, SslProtocols.Tls12 | SslProtocols.Tls13, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
await sslStream.AuthenticateAsClientAsync(_config.Host, new X509CertificateCollection { _config.Certificate }, SslProtocols.Tls12, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await sslStream.AuthenticateAsClientAsync(_config.Host, null, SslProtocols.Tls12 | SslProtocols.Tls13, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
await sslStream.AuthenticateAsClientAsync(_config.Host, null, SslProtocols.Tls12, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
sslDiagnostics?.EndStage("ClientAuth");
|
sslDiagnostics?.EndStage("ClientAuth");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DebugConnection($"SSL authentication successful for {_config.Host}:{_config.Port} using SNI: {_config.Host}, Client Certificate: {(_config.Certificate != null ? "Yes" : "No")}, Enabled Protocols: {(sslStream.SslProtocol)}, Cipher Algorithm: {sslStream.CipherAlgorithm}, Hash Algorithm: {sslStream.HashAlgorithm}, Key Exchange Algorithm: {sslStream.KeyExchangeAlgorithm}");
|
DebugConnection($"SSL authentication successful for {_config.Host}:{_config.Port} using SNI: {_config.Host}, Client Certificate: {(_config.Certificate != null ? "Yes" : "No")}, Enabled Protocols: {(sslStream.SslProtocol)}, Cipher Algorithm: {sslStream.CipherAlgorithm}, Hash Algorithm: {sslStream.HashAlgorithm}, Key Exchange Algorithm: {sslStream.KeyExchangeAlgorithm}");
|
||||||
sslDiagnostics?.RecordSuccess(sslStream);
|
sslDiagnostics?.RecordSuccess(sslStream);
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ namespace EonaCat.Connections
|
|||||||
DebugConnection($"SSL authentication successful for {remoteEndPoint} on attempt {attempt}.");
|
DebugConnection($"SSL authentication successful for {remoteEndPoint} on attempt {attempt}.");
|
||||||
#else
|
#else
|
||||||
sslDiagnostics?.StartStage("ServerAuth");
|
sslDiagnostics?.StartStage("ServerAuth");
|
||||||
await sslStream.AuthenticateAsServerAsync(_config.Certificate, _config.MutuallyAuthenticate, SslProtocols.Tls12 | SslProtocols.Tls13, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
await sslStream.AuthenticateAsServerAsync(_config.Certificate, _config.MutuallyAuthenticate, SslProtocols.Tls12, _config.CheckCertificateRevocation).ConfigureAwait(false);
|
||||||
sslDiagnostics?.EndStage("ServerAuth");
|
sslDiagnostics?.EndStage("ServerAuth");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# EonaCat.Connections
|
# EonaCat.Connections
|
||||||
|
|
||||||
A high-performance, production-ready .NET Framework 4.8+ / .NET 8 compatible library for building scalable TCP/UDP servers and clients with optional TLS encryption and application-layer AES encryption.
|
A high-performance, production-ready .netStandard 2.0, .NET Framework 4.8+ / .NET 8 compatible library for building scalable TCP/UDP servers and clients with optional TLS encryption and application-layer AES encryption.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -904,6 +904,7 @@ public enum DisconnectReason
|
|||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
|
|
||||||
|
- ** .NET Standard 2.0** - Full support
|
||||||
- **.NET Framework 4.8+** - Full support
|
- **.NET Framework 4.8+** - Full support
|
||||||
- **.NET 8.0** - Full support
|
- **.NET 8.0** - Full support
|
||||||
- **Platforms**: Windows, Linux, macOS (with .NET Core)
|
- **Platforms**: Windows, Linux, macOS (with .NET Core)
|
||||||
|
|||||||
Reference in New Issue
Block a user