ConnectionEncryptionData - jimdroberts/FishMMO GitHub Wiki

Description

ConnectionEncryptionData stores encryption-related data for a network connection on the server in FishMMO, including public key, symmetric key, and initialization vector (IV).


API Access

Fields

  • public byte[] PublicKey

    The public key used for encryption with the client.

  • public byte[] SymmetricKey

    The symmetric key used for encrypting communication with the client.

  • public byte[] IV

    The initialization vector (IV) used for symmetric encryption.

Methods

  • public ConnectionEncryptionData(byte[] publicKey, byte[] symmetricKey, byte[] iv)

    Initializes a new encryption data instance with the provided keys and IV. Parameters: - byte[] publicKey: The public key for encryption. - byte[] symmetricKey: The symmetric key for encryption. - byte[] iv: The initialization vector for encryption.


Basic Usage

Setup

  1. Create a new ConnectionEncryptionData instance when establishing a secure connection with a client.
  2. Use the constructor to assign the public key, symmetric key, and IV.
  3. Store and retrieve encryption data as needed for secure communication.

Example

// Example 1: Creating encryption data for a connection
var encryptionData = new ConnectionEncryptionData(publicKey, symmetricKey, iv);

// Example 2: Accessing encryption fields
byte[] key = encryptionData.SymmetricKey;

Best Practices

  • Always generate strong, random keys and IVs for each connection.
  • Store encryption data securely and clear it when the connection is closed.
  • Use the appropriate cryptographic algorithms and key sizes for your security requirements.
⚠️ **GitHub.com Fallback** ⚠️