RSA En/Decryption

Public/Private Key Generation

The private and the corresponding public key can be generated

RSAKeyGeneration.Generate();

Private and public key can be passed to the factories. However, if you choose a factory method with no public/private key parameter, they will be automatically generated.

Enable RSA En/Decryption

Use the ConnectionFactory to create a secure connection.

ConnectionFactory.CreateSecureClientConnectionContainer(...
ConnectionFactory.CreateSecureServerConnectionContainer(...
ConnectionFactory.CreateSecureTcpConnection(...
ConnectionFactory.CreateSecureUdpConnection(...

There is nothing to consider while using RSA. (No code adjustments either) Establishing a UDP connection with a SecureTcpConnection will automatically create a SecureUdpConnection.

Important Notice

  • RSA connections are slower; compared to normal connections.
  • RSA packets are larger; compared to nromal packets.

Switch current code-base to RSA

Simply replace .CreateClientConnectionContainer with .CreateSecureConnectionContainer and .CreateServerConnectionContainer with .CreateSecureServerConnectionContainer.

0 0 vote
Article Rating
Subscribe
Notify of
2 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
fripplo

Thanks for the feature, but do you use RSA for the whole communication?
RSA is usually only used for the key exchange and symmetric cryptography is then used for communication. This will enhance performance and could, depending on the algorithm, provide perfect forward secrecy.