Updated to support .net standard 2.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48; net8.0</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0; net48; net8.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -200,10 +200,17 @@ namespace EonaCat.Connections.Helpers
|
||||
|
||||
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))
|
||||
{
|
||||
return pbkdf2.GetBytes(size);
|
||||
}
|
||||
#else
|
||||
using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, _iterations))
|
||||
{
|
||||
return pbkdf2.GetBytes(size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private static byte[] RandomBytes(int total)
|
||||
|
||||
@@ -541,16 +541,16 @@ namespace EonaCat.Connections
|
||||
sslDiagnostics?.StartStage("ClientAuth");
|
||||
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
|
||||
{
|
||||
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");
|
||||
#endif
|
||||
sslDiagnostics?.EndStage("ClientAuth");
|
||||
#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);
|
||||
if (sslDiagnostics != null)
|
||||
{
|
||||
|
||||
@@ -831,7 +831,7 @@ namespace EonaCat.Connections
|
||||
DebugConnection($"SSL authentication successful for {remoteEndPoint} on attempt {attempt}.");
|
||||
#else
|
||||
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");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# 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
|
||||
|
||||
@@ -904,6 +904,7 @@ public enum DisconnectReason
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- ** .NET Standard 2.0** - Full support
|
||||
- **.NET Framework 4.8+** - Full support
|
||||
- **.NET 8.0** - Full support
|
||||
- **Platforms**: Windows, Linux, macOS (with .NET Core)
|
||||
|
||||
Reference in New Issue
Block a user