QRCLibGitHub

Encrypt, then prove who sent it.

Alice encapsulates to Bob’s long-term X-Wing key. Both sides turn that shared secret into an AES-256-GCM key. Every packet is hybrid-signed, and the receiver checks the signature before decrypting.

Bringing the session up

  1. 01

    The offer is a single X-Wing encapsulation.

    It is signed so Bob knows it came from Alice. Both sides then run HKDF to get the session key. You only see the first eight bytes of that key.

  2. 02

    A message is a nonce, a ciphertext, and a signature.

    The other party verifies with the sender’s public key. Only then does AES-GCM open it. Changing the text in flight fails that check.

  3. 03

    This is not forward secret.

    If Bob’s long-term X-Wing secret leaks later, the recorded offer can be decapsulated and the session key recomputed. Rotating that key is what bounds the window.

waiting on key generation

Nothing has been delivered yet.

Same call in Python
from qrclib.messaging import Mailbox

alice, bob = Mailbox("alice"), Mailbox("bob")
bob.accept(alice.offer(bob.kem.public_key), alice.signing.public_key)
alice.bind_peer(bob.signing.public_key)
print(bob.decrypt(alice.encrypt(b"18.4")))