BNETDocs
File Transfer Protocol Version 2

Version 2 of Battle.net's file transfer protocol (BNFTPv2) is a simple extension to version one, which allows Battle.net to validate a CD key before allowing a file transfer to take place.

The request is sent to Battle.net after connecting and requesting protocol BNFTP (0x02):

    (UINT16)    Length of this message
    (UINT16)    Protocol Version
   (UINT32)    Platform ID
   (UINT32)    Product ID
   (UINT32)    Banner ID
   (UINT32)    BannerExtension

Battle.net responds to this request by sending a challenge in the form of the Server Token to be used as part of the CD key hash:

   (UINT32)    Server Token

The client should respond to this challenge with the following message:

   (UINT32)    Starting position (facilitates resuming)
(FILETIME)    Local filetime
   (UINT32)    Client Token
   (UINT32)    Key Length
   (UINT32)    Key's product value
   (UINT32)    Key's public value
   (UINT32)    Unknown (Always 0)
   (UINT32)[5] CD key hash
  (STRING)    Filename

The CD key is hashed in exactly the same manner as for SID_AUTH_CHECK. If the key is rejected, the server disconnects. If the key is accepted, the server responds with the following message:

   (UINT32)    Length of this message (not including file data)
   (UINT32)    File size
   (UINT32)    Banner ID
   (UINT32)    Banner Extension
(FILETIME)    Remote Filetime
  (STRING)    Filename
    (VOID)    File data

After receiving the complete file data (determined by the filesize), the client terminates the connection.

The starred fields (*) are only required when downloading an ad banner. In other cases, they should be set to 0. Version 2 of BNFTP actually has a version of 0x200 (512).

| Edited: RealityRipple
Comments

no one has commented yet.