- D 87%
- C 10.9%
- Makefile 2.1%
| src | ||
| .gitignore | ||
| COPYING | ||
| Makefile | ||
| README.md | ||
LibreShield is an experimental alternative to mTLS for secure communication across untrusted networks. It features post-quantum cryptography (PQC), perfect forward secrecy and anti-replay protection. LibreShield can be used with any transport layer protocol, provided that streams are reliable and in-order.
Examples
Generating an identity:
JSONValue cert;
JSONValue identity;
libreshield.generateIdentity(identity, cert);
Creating a session:
libreshield.Session client;
libreshield.Session server;
scope(exit) client.erase();
scope(exit) server.erase();
client.load(clientIdentity, serverCert);
server.load(serverIdentity, clientCert);
ubyte[] clientHello = client.clientHandshake();
ubyte[] serverHello = server.serverHandshake(clientHello);
client.clientStart(serverHello);
server.serverStart();
Exchanging messages:
ubyte[] clientMessage = cast(ubyte[]) "Hello from client!";
ubyte[] serverMessage = cast(ubyte[]) "Hello from server!";
c1 = client.seal(clientMessage);
c2 = server.seal(serverMessage);
assert(client.unseal(c2) == serverMessage);
assert(server.unseal(c1) == clientMessage);
Cryptography
Identities use a hybrid combination of ed25519 and ML-DSA-65. Key exchange uses a hybrid combination of ECDH (X25519) and KEM (ML-KEM-768). Messages are encrypted using XChaCha20-Poly1305.
Guidance and limitations
LibreShield has not undergone a security audit; exercise caution.
LibreShield provides mutual authentication and transport security, but it does not hide the identities of the communicating parties. If your threat model requires this, you would be better served by mTLS 1.3 or a protocol based on Noise.
If you are defining a new protocol, you should consider compressing your plaintexts (e.g. with zstd) prior to encryption. You should also consider the use of a messaging library (e.g. ZeroMQ).
Compatibility
LibreShield should work correctly on systems which implement 64-bit (LP64) POSIX or POSIX-oriented standards. However, the Makefile (which builds the module and the test suite) is currently configured for GNU/Linux on amd64.
Build
To build the module and the test suite, the following dependencies are required:
- the GNU D compiler
- GNU Make
- libsodium
- liboqs
then run:
make prepare && make
Report a bug
Report bugs directly to hello@indraj.net.
For security bugs, please allow up to 48 hours for a reply and up to 90 days for the issue(s) to be confirmed and fixed before disclosing them publicly.
License
LibreShield is licensed under the GNU General Public License version 3 or later.