20 lines
719 B
C#
20 lines
719 B
C#
|
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));
|
||
|
}
|
||
|
}
|