ConnectionEncryptionData - jimdroberts/FishMMO GitHub Wiki
ConnectionEncryptionData
stores encryption-related data for a network connection on the server in FishMMO, including public key, symmetric key, and initialization vector (IV).
-
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.
-
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.
- Create a new
ConnectionEncryptionData
instance when establishing a secure connection with a client. - Use the constructor to assign the public key, symmetric key, and IV.
- Store and retrieve encryption data as needed for secure communication.
// Example 1: Creating encryption data for a connection
var encryptionData = new ConnectionEncryptionData(publicKey, symmetricKey, iv);
// Example 2: Accessing encryption fields
byte[] key = encryptionData.SymmetricKey;
- 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.