Hash password at server side

This commit is contained in:
Sardelka
2022-07-29 14:51:17 +08:00
parent 095d16a57e
commit 577857ab5a
3 changed files with 5 additions and 5 deletions

View File

@ -91,7 +91,7 @@ namespace RageCoop.Client
PedID = Main.LocalPlayerID,
Username =username,
ModVersion = Main.CurrentVersion,
PassHashEncrypted=Security.Encrypt(password.GetSHA256Hash())
PasswordEncrypted=Security.Encrypt(password.GetBytes())
};
Security.GetSymmetricKeysCrypted(out handshake.AesKeyCrypted, out handshake.AesIVCrypted);

View File

@ -29,7 +29,7 @@ namespace RageCoop.Core
/// <summary>
/// The password hash with client Aes
/// </summary>
public byte[] PassHashEncrypted { get; set; }
public byte[] PasswordEncrypted { get; set; }
public override void Pack(NetOutgoingMessage message)
{
@ -59,7 +59,7 @@ namespace RageCoop.Core
// Write PassHash
byteArray.AddArray(PassHashEncrypted);
byteArray.AddArray(PasswordEncrypted);
byte[] result = byteArray.ToArray();
@ -87,7 +87,7 @@ namespace RageCoop.Core
AesIVCrypted=reader.ReadByteArray();
PassHashEncrypted=reader.ReadByteArray();
PasswordEncrypted=reader.ReadByteArray();
#endregion
}
}

View File

@ -562,7 +562,7 @@ namespace RageCoop.Server
try
{
Security.AddConnection(connection.RemoteEndPoint, packet.AesKeyCrypted,packet.AesIVCrypted);
passhash=Security.Decrypt(packet.PassHashEncrypted, connection.RemoteEndPoint).ToHexString();
passhash=Security.Decrypt(packet.PasswordEncrypted, connection.RemoteEndPoint).GetString().GetSHA256Hash().ToHexString();
}
catch (Exception ex)
{