Skip to content

Commit

Permalink
Added access to Raknet RSA functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccw808 committed Oct 22, 2015
1 parent e319788 commit 622ee52
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions MTA10_Server/sdk/net/CNetServer.h
Expand Up @@ -147,6 +147,37 @@ class CNetServer
virtual bool GetPlayerPacketUsageStats ( uchar* packetIdList, uint uiNumPacketIds, SPlayerPacketUsage* pOutStats, uint uiTopCount ) { return false; }
virtual const char* GetLogOutput ( void ) { return NULL; }
virtual bool IsValidSocket ( const NetServerPlayerID& playerID ) { assert( 0 ); return false; }

//
// RSA structures:
//
// private key (64 bytes):
// 32 bytes p (prime1)
// 32 bytes q (prime2)
//
// public key (68 bytes):
// 4 bytes e (public exponent)
// 64 bytes n (modulus)
//
// encrypted data:
// 4 bytes original size
// 64+ bytes data
//

// RSAGenerateKeys
// PrivateKeySize must be set to 64, PublicKeySize must be set to 68.
// Returns false on failure.
virtual bool RSAGenerateKeys ( char* pOutPrivateKey, uint uiPrivateKeySize, char* pOutPublicKey, uint uiPublicKeySize ) { assert( 0 ); return false; }

// RSAEncryptData
// MaxOutputDataSize should be slightly larger than the input size.
// Returns actual size of encrypted data, or zero on failure.
virtual uint RSAEncryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }

// RSADecryptData
// MaxOutputDataSize can be the same size as the input size.
// Returns actual size of decrypted data, or zero on failure.
virtual uint RSADecryptData ( const char* pInputData, uint uiInputDataSize, const char* pKey, uint uiKeySize, char* pOutputData, uint uiMaxOutputDataSize ) { assert( 0 ); return 0; }
};

#endif
Expand Down
2 changes: 1 addition & 1 deletion MTA10_Server/version.h
Expand Up @@ -78,7 +78,7 @@

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

Expand Down

0 comments on commit 622ee52

Please sign in to comment.