Skip to content

Commit d86d97a

Browse files
committed
Added access to Raknet RSA functions.
1 parent 98d9c56 commit d86d97a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

MTA10_Server/sdk/net/CNetServer.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,37 @@ class CNetServer
147147
virtual bool GetPlayerPacketUsageStats ( uchar* packetIdList, uint uiNumPacketIds, SPlayerPacketUsage* pOutStats, uint uiTopCount ) { return false; }
148148
virtual const char* GetLogOutput ( void ) { return NULL; }
149149
virtual bool IsValidSocket ( const NetServerPlayerID& playerID ) { assert( 0 ); return false; }
150+
151+
//
152+
// RSA structures:
153+
//
154+
// private key (64 bytes):
155+
// 32 bytes p (prime1)
156+
// 32 bytes q (prime2)
157+
//
158+
// public key (68 bytes):
159+
// 4 bytes e (public exponent)
160+
// 64 bytes n (modulus)
161+
//
162+
// encrypted data:
163+
// 4 bytes original size
164+
// 64+ bytes data
165+
//
166+
167+
// RSAGenerateKeys
168+
// PrivateKeySize must be set to 64, PublicKeySize must be set to 68.
169+
// Returns false on failure.
170+
virtual bool RSAGenerateKeys ( char* pOutPrivateKey, uint uiPrivateKeySize, char* pOutPublicKey, uint uiPublicKeySize ) { assert( 0 ); return false; }
171+
172+
// RSAEncryptData
173+
// MaxOutputDataSize should be slightly larger than the input size.
174+
// Returns actual size of encrypted data, or zero on failure.
175+
virtual uint RSAEncryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }
176+
177+
// RSADecryptData
178+
// MaxOutputDataSize can be the same size as the input size.
179+
// Returns actual size of decrypted data, or zero on failure.
180+
virtual uint RSADecryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }
150181
};
151182

152183
#endif

MTA10_Server/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
#define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR)
8080
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
81-
#define _SERVER_NET_MODULE_VERSION 0x095 // (0x000 - 0xfff) Lvl9 wizards only
81+
#define _SERVER_NET_MODULE_VERSION 0x096 // (0x000 - 0xfff) Lvl9 wizards only
8282
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
8383
#define MTA_DM_BITSTREAM_VERSION 0x064 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
8484

0 commit comments

Comments
 (0)