TigerEmu/Communication/Messages/Incoming/Handshake/GenerateKeyEvent.cs

20 lines
719 B
C#
Raw Normal View History

2023-11-10 13:55:42 +00:00
using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Outgoing.Handshake;
using Tiger.Communication.Messages.Types;
using Tiger.Networking.Game.Sessions;
using Tiger.Security;
namespace Tiger.Communication.Messages.Incoming.Handshake;
public class GenerateKeyEvent : IMessageEvent
{
public IncomingHeaders Header => IncomingHeaders.GenerateKey;
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
{
var publicKey = HabboEncryption.GenerateKey();
var decodedKey = HabboEncryption.DecodeKey(publicKey);
gameSession.Rc4 = new Rc4(decodedKey);
await gameSession.SendComposerAsync(new SecretKeyComposer(publicKey));
}
}