Sample code for the ISARA Quantum-Safe library. Each directory has one or more self-contained programs inside demonstrating how to use the library for a specific purpose:
-
mldsa— Generate ML-DSA keys, sign a file's data with a ML-DSA key, and verify a ML-DSA signature. -
mlkem— Encapsulate and decapsulate a generated shared key using ML-KEM. -
lms— Generate keys, sign a file's data, and verify a signature using the LMS algorithm. -
xmss— Generate keys, sign a file's data, detach signatures from a private key's state, and verify a signature using the XMSS algorithm. -
aead_chacha20_poly1305— Encrypt/decrypt using ChaCha20/Poly1305 for authenticated encryption. -
chacha20— Encrypt/decrypt using ChaCha20. -
hash— Hash a file's data using SHA2-256, SHA2-384, SHA2-512, SHA3-256, or SHA3-512. -
kdf— Derive a key (some pseudorandom data) using the specified key derivation function. -
mac— Generate a message authentication code using the specified MAC algorithm. -
rng— Generate pseudorandom bytes using HMAC-DRBG. -
common— A small library of functions common to the samples. -
integration— Integrating the library with other software. -
version— Display the library's version information.
The integration directory has samples showing how to integrate external
implementations with the library. These samples may have external dependencies
on specific software such as OpenSSL, or specific operating system features such
as having a /dev/urandom device available.
-
integration/hash-openssl— Use OpenSSL 1.1.1 or newer's SHA2-256, SHA2-512, SHA3-256, and SHA3-512 with the library's hash API. -
integration/rng-cng— Use the Windows Cryptography API: Next Generation (CNG) with the library's random number generator API. -
integration/rng-urandom— Use/dev/urandomwith the library's random number generator API.
The samples are intended to demonstrate specific API use. They don't demonstrate any specific security practices.
NOTE
In addition to your platform's usual development tools, you'll need a recent
version of cmake (version 3.22 or newer):
https://cmake.org/For most systems,
you can use your platform's normal package tools to install it, but you may
need to build an up-to-date version. Binaries are also available on the CMake
website.
The samples use the IQR_LIBRARY_ROOT CMake or environment variable to
determine the location of the library to build against. CMake requires that
environment variables are set on the same line as the CMake command, or are
exported environment variables in order to be read properly. If
IQR_LIBRARY_ROOT is a relative path, it must be relative to the directory
where you're running the cmake command.
To build all of the samples using the command-line:
-
Install the library somewhere, e.g.
/path/to/library/. -
cdto thesamplesdirectory, such as/path/to/library/samples/. -
Use
mkdirto make abuilddirectory;cdinto thebuilddirectory. -
Run CMake:
cmake -DIQR_LIBRARY_ROOT=/path/to/library/ ..orIQR_LIBRARY_ROOT=/path/to/library cmake ..The..in there refers to the parent of yourbuilddirectory, so it'll pick up theCMakeLists.txtin the mainsamplesdirectory. -
Run make:
make
This will build the samples in individual directories under the build
directory.
Use -DSTATIC=ON to link against the static library instead of the
default shared library.
To build individual samples:
-
Install the library somewhere, e.g.
/path/to/library/. -
cdto the specificsamplesdirectory, such as/path/to/library/samples/hash. -
Use
mkdirto make abuilddirectory;cdinto thebuilddirectory. -
Run CMake:
cmake -DIQR_LIBRARY_ROOT=/path/to/library/ ..orIQR_LIBRARY_ROOT=/path/to/library cmake ..The..in there refers to the parent of yourbuilddirectory, so it'll pick up theCMakeLists.txtin the specificsamplesdirectory (the one inhashin this case). -
Run make:
make
This will build the specific sample in the build directory.
See individual README.html files in the sample subdirectories for instructions
on running specific samples.
Execute the samples with no arguments to use the default parameters, or use
--help to list the available options.
For information about reporting security issues, please read the SECURITY document.
You can read the library documentation online at ISARA's website:
See the LICENSE file for details:
Copyright © 2016-2026, ISARA Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
ISARA Radiate™ is a trademark of ISARA Corporation.