mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
git
This commit is contained in:
parent
47a816f700
commit
b4441c82ee
@ -62,7 +62,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
|
||||
<PackageReference Include="System.Collections" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.Diagnostics.StackTrace" Version="4.3.0" />
|
||||
@ -73,10 +73,10 @@
|
||||
<PackageReference Include="System.Net.Security" Version="4.3.2" />
|
||||
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
|
||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.2" GeneratePathProperty="true" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.3" GeneratePathProperty="true" />
|
||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
|
||||
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
|
||||
|
||||
</ItemGroup>
|
||||
|
@ -226,42 +226,94 @@ public partial class DistributedConnection : NetworkConnection, IStore
|
||||
|
||||
private void Declare()
|
||||
{
|
||||
var dmn = DC.ToBytes(session.LocalAuthentication.Domain);// domain);
|
||||
var dmn = DC.ToBytes(session.LocalAuthentication.Domain);
|
||||
|
||||
if (session.LocalAuthentication.Method == AuthenticationMethod.Credentials)
|
||||
if (session.Encrypted)
|
||||
{
|
||||
// declare (Credentials -> No Auth, No Enctypt)
|
||||
// create key
|
||||
//var ecdh = System.Security.Cryptography.ECAlgorithm.ECDiffieHellman.Create();
|
||||
|
||||
var un = DC.ToBytes(session.LocalAuthentication.Username);
|
||||
if (session.LocalAuthentication.Method == AuthenticationMethod.Credentials)
|
||||
{
|
||||
// declare (Credentials -> No Auth, No Enctypt)
|
||||
|
||||
SendParams()
|
||||
.AddUInt8(0x60)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt8((byte)un.Length)
|
||||
.AddUInt8Array(un)
|
||||
.Done();//, dmn, localNonce, (byte)un.Length, un);
|
||||
var un = DC.ToBytes(session.LocalAuthentication.Username);
|
||||
|
||||
SendParams()
|
||||
.AddUInt8(0x60)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt8((byte)un.Length)
|
||||
.AddUInt8Array(un)
|
||||
.Done();//, dmn, localNonce, (byte)un.Length, un);
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.Token)
|
||||
{
|
||||
|
||||
SendParams()
|
||||
.AddUInt8(0x70)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt64(session.LocalAuthentication.TokenIndex)
|
||||
.Done();//, dmn, localNonce, token
|
||||
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.None)
|
||||
{
|
||||
SendParams()
|
||||
.AddUInt8(0x40)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.Done();//, dmn, localNonce, token
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("Authentication method is not implemented.");
|
||||
}
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.Token)
|
||||
else
|
||||
{
|
||||
if (session.LocalAuthentication.Method == AuthenticationMethod.Credentials)
|
||||
{
|
||||
// declare (Credentials -> No Auth, No Enctypt)
|
||||
|
||||
SendParams()
|
||||
.AddUInt8(0x70)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt64(session.LocalAuthentication.TokenIndex)
|
||||
.Done();//, dmn, localNonce, token
|
||||
var un = DC.ToBytes(session.LocalAuthentication.Username);
|
||||
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.None)
|
||||
{
|
||||
SendParams()
|
||||
.AddUInt8(0x40)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.Done();//, dmn, localNonce, token
|
||||
SendParams()
|
||||
.AddUInt8(0x60)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt8((byte)un.Length)
|
||||
.AddUInt8Array(un)
|
||||
.Done();//, dmn, localNonce, (byte)un.Length, un);
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.Token)
|
||||
{
|
||||
|
||||
SendParams()
|
||||
.AddUInt8(0x70)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.AddUInt8Array(localNonce)
|
||||
.AddUInt64(session.LocalAuthentication.TokenIndex)
|
||||
.Done();//, dmn, localNonce, token
|
||||
|
||||
}
|
||||
else if (session.LocalAuthentication.Method == AuthenticationMethod.None)
|
||||
{
|
||||
SendParams()
|
||||
.AddUInt8(0x40)
|
||||
.AddUInt8((byte)dmn.Length)
|
||||
.AddUInt8Array(dmn)
|
||||
.Done();//, dmn, localNonce, token
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("Authentication method is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,9 @@ public class Session
|
||||
Authentication localAuth, remoteAuth;
|
||||
//string domain;
|
||||
|
||||
public bool Encrypted { get; set; }
|
||||
|
||||
|
||||
public Session(Authentication localAuthentication, Authentication remoteAuthentication)
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user