WinMX Encryption For Visual Basic 6.0:
The Encryption Methods:
If you are planning to make a WinMX application in Visual
Basic 6.0, you are going to need these two files to be successful.
They are basically the DLL calls for using the mxsock.dll, but this
version of the DLL is modified (Thanks to Krish). Although it
doesn't include the UDP functions, you should be able to make a very
successful application.
Download DLL Pack:
Download VB6 DLL + DLL Call Module Here.
Decrypting/Encrypting Functions:
Below shows how to use the encryption functions and what
they are for.
DecryptFrontCode(ByVal
pSrc As String, ByVal pDst As String)
When connecting to a cache server to get 10 primary nodes,
they are encrypted and this is what you need to use to decrypt them.
Parameters:
pSrc: (IN) - Message from peer cache server. Buffer must be
132 Bytes.
pDst: (Out) - Primary Node Addresses. - 120 Bytes
Node Structure:
DWORD [4] IPAddress
WORD [2] UDPPort
WORD [2] TCPPort
BYTE [1] Free Primaries
BYTE [1] Free Secondaries
WORD [2] Blank for splitting
DecryptMXTCP(ByVal
pBuf As String, ByVal iLen As Long, ByVal dwKey As Long) as Long:
When connecting to any WinMX Server/Client they all use
encryption and you must use Encryption keys to communicate with each
other to tell what you are.
Crypt Key ID Options:
0x0050 - Primary Client
0x0051 - Primary Server
0x0052 - Secondary Client
0x0053 - Secondary Server
0x0054 - Cache Server
0x0057 - Chat Client
0x0058 - Chat Server
Parameters:
wDI: (IN) - The Crypt Key ID
pBlock: (Out) - Key Block. Buffer must be 16 bytes.
GetCryptKeyID(ByVal pBlock As String) as
Long:
This checks a key block for the Key ID.
Parameters:
pBlock: (IN) - The Key Block. 16 bytes.
Return Value:
WNPN Key ID
GetCryptKey(ByVal pBlock As String, ByRef
pUpKey As Long, ByRef pDwKey As Long) As Long:
When establishing the encryption between a client and
server for the WinMX network, they need to extract the encryption
keys from the key blocks. There is a key for data sent and there is
a key for the data received. They both mutate when run through the
encryption/decryption algorithm.
Parameters:
pBlock: (IN) - The Key Block. 16 Bytes.
pUpKey (Out) - The Upload Key
pDwKey (Out) - The Download Key
Return Value:
WNPN Key ID
EncryptMXTCP(ByVal pBuf As String, ByVal
iLen As Long, ByVal dwKey As Long):
When communicating with other WinMX clients or servers on a
TCP connection the data is encrypted. This function encrypts the
data, and the return value is the new encryption key.
Parameters:
pBuf: (IN) - The Data to be encrypted
iLen (IN) - The Length of the data
dwKey (IN) - The Crypt Key (Upload)
Return Value:
New Crypt Key (Upload)
DecryptMXTCP(ByVal
pBuf As String, ByVal iLen As Long, ByVal dwKey As Long):
When communicating with other WinMX clients or servers on a
TCP connection the data is encrypted. This function encrypts the
data, and the return value is the new encryption key.
Parameters:
pBuf: (IN) - The Data to be decrypted
iLen (IN) - The Length of the data
dwKey (IN) - The Crypt Key (Download)
Return Value:
New Crypt Key (Download)
Note: If you find any errors or
have any more questions please post in the forum under the
encryption section. Thanks.