From 0ba2be666f68dda7a76d28e7cd8c74812c501d9f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 6 Sep 2012 17:36:59 +0000 Subject: Added protocol-specific authentication, now works for both 1.2.5 and 1.3.2 git-svn-id: http://mc-server.googlecode.com/svn/trunk@841 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol132.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/Protocol132.h') diff --git a/source/Protocol132.h b/source/Protocol132.h index 3117af777..cca91c44b 100644 --- a/source/Protocol132.h +++ b/source/Protocol132.h @@ -40,6 +40,8 @@ public: virtual void SendPlayerSpawn (const cPlayer & a_Player) override; virtual void SendSpawnMob (const cMonster & a_Mob) override; virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; + + virtual AString GetAuthServerID(void) override; // DEBUG: virtual void SendKeepAlive (int a_PingID) override; @@ -64,6 +66,12 @@ protected: CryptoPP::CFB_Mode::Encryption m_Encryptor; AString m_DataToSend; + /// The ServerID used for session authentication; set in StartEncryption(), used in GetAuthServerID() + AString m_AuthServerID; + + /// The server's public key, as used by SendEncryptionKeyRequest() and StartEncryption() + AString m_ServerPublicKey; + virtual void SendData(const char * a_Data, int a_Size) override; // DEBUG: @@ -74,12 +82,12 @@ protected: virtual int ParseItem(cItem & a_Item) override; virtual void SendCompass(const cWorld & a_World); - virtual void SendEncryptionKeyRequest(const AString & a_Key); + virtual void SendEncryptionKeyRequest(void); /// Decrypts the key and nonce, checks nonce, starts the symmetric encryption void HandleEncryptionKeyResponse(const AString & a_EncKey, const AString & a_EncNonce); - /// Starts the symmetric encryption with the specified key + /// Starts the symmetric encryption with the specified key; also sets m_AuthServerID void StartEncryption(const byte * a_Key); } ; -- cgit v1.2.3