This repository implements a Quantum Entropy as a Service (QEaaS) server, providing access to quantum random numbers generated by Quantis QRNG devices (PCIe-240M and USB-4M) through HTTP and CoAP APIs. It includes a C++ HTTP API, an nginx reverse proxy with TLS support (including post-quantum algorithms), and a libcoap proxy for CoAP access with post-quantum cryptography support through wolfSSL integration. The system is containerized using Docker.
After cloning, manually initialize and update the git submodules with the following command:
git submodule update --init --recursive
First, run the script to set up the environment by updating submodules and copying necessary configuration files
./setup-and-clean.sh
Then, build the API service, the nginx reverse proxy, and the libcoap proxy
docker-compose up --build
Test the nginx reverse proxy with
docker run --network host --rm -it openquantumsafe/curl curl -k https://127.0.0.1:4433/random_number/5
docker run --network host --rm -it openquantumsafe/curl curl -k --curves kyber512 https://127.0.0.1:4433/random_number/5
In these examples, /random_number/5
requests 5 random bytes from the API. You can adjust this number to request more or fewer random bytes as needed. Test the CoAP to HTTP proxy with
docker run --rm --network host my-coap2http-server ./libcoap/build/coap-client -P coaps://[::1]/ -m get http://127.0.0.1:6065/random_number/5
Similarly, this CoAP request also asks for 5 random bytes. Modify the number at the end of the URL to request a different amount of random data.
The server architecture is illustrated in the following figure. While not explicitly shown in the diagram, the HTTP API, nginx reverse proxy (with OpenSSL), and CoAP proxy (with wolfSSL) are containerized for easier deployment: