bcu8 / Kyber-Socket

Simple Linux / Windows friendly C++ class for kyber1024 / AES256 network communication
Creative Commons Zero v1.0 Universal
4 stars 0 forks source link
aes cpp kyber pqc socket

Kyber Socket

The Socket class provides socket functionality for encrypted network communication in C++. The code is designed to compile automatically on Linux or Windows through the use of compiler directives. Additional compilation options are provided in the Socket.h file for enabling cryptography and verbose output.

Description

The Socket class is subclassed into Server and Client subclasses. In the constructor of either class, the initial operations involved in the process of creating the socket are handled using the respective constructor input variables. See the demonstration code for more details about how to instantiate these classes.

The encryption is AES256 which relies on a PQC (post quantum cryptography) algorithm called Kyber1024 to generate a symmetric key for both communicating sockets. The key is securely transferred over the network in a process that looks like this.

  1. Alice generates a public and private keypair
  2. Alice sends Bob her public key
  3. Bob generates a new 32 byte shared key
  4. Bob encapsulates the shared key using Alices public key and sends it to Alice
  5. Alice decapsulates the shared key using her private key
  6. Now both parties have a shared secret 32 byte key which can be used in AES256

After this process, encrypt and decrypt functions are used on all outgoing and incoming messages into the socket until disabled by the setCryptography() function.

Getting Started

Dependencies

If you dont want the cryptography functionality, you can set CRYPTOGRAPHY = false in the Socket.h file and ignore these steps. Otherwise..

Usage

Authors

License

This project is licensed under the CC0 1.0 Universal License - see the LICENSE.md file for details

Acknowledgments