Skip to content

ntl92bk/MiTransport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MiTransport

Secure transport for Mirror

Info

  • Using RSA for handshake phase (pre-generated)
  • Using AES for data exchange
  • Only encrypt message sent by reliable channel

How it work

mi_sequence

  1. Pre-generate the Rsa key pair
  2. Client random AES key, iv (K1, IV1)
  3. The client encrypts (K1, IV1) and sends it to the server using the rsa public key.
  4. The server receives and decrypts ciphertext using rsa private key to get (K1, IV1).
  5. The server generates a random Aes key, iv (K2, IV2), and uses the following formula to calculate the final key, iv (K, IV): K=K1 XOR K2, IV = IV1 XOR IV2.
  6. (K2, IV2) is encrypted with (K1, IV1) and sent to the Client by the Server.
  7. The client uses (K1, IV1) to decrypt ciphertext to get (K2, IV2).
  8. The client calculate the final key, iv (K, IV) with same formula as server.
  9. Client sends a Confirm message that is encrypted with (K, IV), and the client side handshake is complete.
  10. The server confirms the message by decrypting it with (K, IV). The server side handshake has been completed.
  11. With (K, IV), the client and server exchange data and encrypt and decrypt messages.

How to use

  1. Enable "Allow 'unsafe' code" in Player Settings
  2. Add MiTransport.cs to NetworkManager game object.
  3. Drag current transport to MiTransport innerTransport field.
  4. Replace transport on your NetworkManager to MiTransport.
  5. Click Generate keypair button and save scene.

Credits

Inspired by Monke Transport

About

Secure transport for Mirror

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages