Quside’s QRNG Integration with Rust
Quside develops new-generation quantum technologies for secure connectivity and efficient computation.
Published on 3 July 2024
In recent weeks, our team at Quside has been working on an exciting project: integrating our Quantum Random Number Generator (QRNG) with the Rust programming language. In this blog post, we detail the process and advantages of this integration, which is aimed at developers and technology enthusiasts.
About Quside’s QRNG
Quantum Random Number Generators (QRNGs) leverage quantum mechanics principles to produce sequences of truly random numbers with measurable quality. Unlike pseudo-random number generators (PRNGs), which generate sequences that only appear random, QRNGs are intrinsically unpredictable. This makes them ideal, even imperative, for applications where genuine randomness is crucial, such as cryptography.
Quside’s QRNG comes in various form factors, from appliances with exposed REST APIs to PCIe cards for Linux and Windows devices. It has native interfaces in C and adapters for other programming languages like Python.
Why Rust?
When choosing the next way forward for our device, we selected Rust for several key reasons:
- Rust’s memory management security: Rust is known for safely handling memory, which is one of its most praised features. Rust uses a system of ownership with rules that the compiler checks at compile time, making common issues like buffer overflows and race conditions difficult or even impossible. Since many software vulnerabilities are traceable to a wrong memory management approach, Rust is in a great position to avoid these issues from the very beginning, as recognized even by institutions such as The White House.
- Rust offers performance close to C and C++, making it an excellent complementary language to these. In fact, it is increasingly being used intensively in the kernels of several operating systems. In Linux, for example, Rust is used in the BPF subsystem, and in Windows, it is used in the Windows Subsystem for Linux (WSL), as well as other core components.
- The active and supportive Rust community, with members such as Mozilla, Microsoft, Amazon, and Google, actively contributes to the language and its ecosystem. This community is also very welcoming to newcomers, making it easier to get started with Rust and making solving problems and adopting new technologies more accessible.
Integration Process
The first step in our integration was to develop an API that allows Rust developers to access the capabilities of the QRNG. We designed this API to be intuitive and efficient, leveraging Rust’s features to ensure optimal performance.
We created an interface that securely and efficiently exposes the functionalities of the QRNG, very similar to our C interface, to facilitate migration for our current users. Additionally, the API allows for the generation of random numbers with a simple function call.
To minimize the impact of transitioning to Rust, the libraries optimize the communication between the QRNG device and the Rust runtime environment, minimizing latency and ensuring the consistency of the generated data.
Regarding the integration, getting started with Quside’s QRNG in Rust is straightforward and user-friendly. You just need to:
- Install the card and its drivers: Install the QRNG hardware and its corresponding drivers on your system. Our devices have a comprehensive installation guide to ensure a smooth setup process.
- Import the crate into your codebase: Add the Quside QRNG crate to your Rust project’s `Cargo.tomlI` file.
- Call the random numbers from the board directly: Once the crate is imported, you can start generating random numbers with just a few lines of code, as shown above.
Benefits for Developers
Integrating our QRNG with Rust offers developers several tangible benefits. The most obvious is the potential to enhance the security of their implementations by providing direct and easy access to a quantum entropy source, improving the security of their cryptographic applications. Additionally, the combination of Rust and Quside’s QRNG facilitates the development of secure applications not only from an entropy standpoint but also from a memory management perspective without sacrificing performance or efficiency. Finally, the API we have developed is straightforward to integrate into existing projects, allowing Rust developers to start using quantum random numbers directly with no friction.
Future and Next Steps
We are excited about the possibilities this integration offers. In the future, we plan to continue optimizing the API and exploring new applications in emerging areas, such as post-quantum cryptography or statistical simulations. Additionally, we are committed to staying up-to-date with Rust’s updates and improvements to fully leverage its capabilities and adapt the interface and functionalities to the developer community’s needs.
Integrating our QRNG with Rust is a significant step toward creating more secure and efficient applications. We invite the developer community to explore this tool and share their experiences and feedback. For more technical details and access to our APIs, please contact us at hello@quside.com or our website, www.quside.com.
Keep reading
- Foundations
Device identity and secure provisioning
A device identity is a key pair generated inside the device and bound to it, which the device uses to prove what it is. Its strength is fixed at the moment of generation: entropy available at first provisioning determines whether the identity is unique and unpredictable for the device's entire life.
- Foundations
What is a hardware root of trust, and what it actually protects
A hardware root of trust is an immutable anchor — typically a key and verification logic in silicon — that the rest of a system's trust chain is built on. It establishes what code was allowed to run and protects the key material underneath, and it cannot verify anything about its own correctness.
- Foundations
Hardware or software root of trust
A software root of trust relies on the platform's existing protections to keep its key secret; a hardware one puts the key somewhere software cannot reach. Software is a defensible choice when the threat model excludes physical access and the platform already isolates well, and it stops being one when either assumption fails.