Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 90fd518

Browse files
committed
tests: add mceliece
1 parent 87f966e commit 90fd518

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66

77
## 🔒 Security Model & Features
88
- **Best‑case security**: achieves [unbreakable encryption](https://en.wikipedia.org/wiki/One-time_pad) under the principles of information theory using [one‑time pads](https://en.wikipedia.org/wiki/One-time_pad)
9-
- **Worst‑case security**: falls back only to ML‑KEM‑1024 (Kyber) resistance
9+
- **Worst‑case security**: falls back only to combined security of ML‑KEM‑1024 and McEliece8192128
1010
- **Perfect-Forward-Secrecy**: on every [OTP](https://en.wikipedia.org/wiki/One-time_pad) batch through ephemeral PQC key exchanges
1111
- **Plausible Deniability**: messages are not cryptographically tied to you, providing more deniability than [Off‑The‑Record messaging](https://en.wikipedia.org/wiki/Off-the-record_messaging) !
1212
- **Mandatory SMP**: We enforce [Socialist millionaire problem](https://en.wikipedia.org/wiki/Socialist_millionaire_problem) before any chat. **MiTM attacks are impossible**.
13-
- **NIST PQC Tier‑5**: We use highest security algorithms (Kyber1024, Dilithium5) that provide AES‑256 strength using [OQS Project](https://openquantumsafe.org/)
1413
- **Minimal Attack Surface**:
1514
- Tkinter UI only, no embedded browsers or HTML
1615
- Minimal Python dependecies

logic/background_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def background_worker(user_data, user_data_lock, ui_queue, stop_flag):
6363
# *Sigh* I had to put this here because if we rotate before finishing reading all of the messages
6464
# we would literally overwrite our own key.
6565
# TODO: We need to keep the last used key and use it when decapsulation with new key gives invalid output
66-
# because it might actually take some time for our keys to be uploaded to server + other servers and to the contact.
66+
# because it might actually take some time for our keys to be uploaded to server + other servers, and to the contact.
6767
#
6868
update_ephemeral_keys(user_data, user_data_lock)
6969

tests/test_crypto.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# tests/test_crypto.py
22
"""
3-
Tests for ML-KEM-1024 (Kyber) and ML-DSA-87 (Dilithium5).
3+
Tests for ML-KEM-1024, ML-DSA-87, Classic-McEliece-8192128f.
44
Covers:
55
- Key generation conformance to NIST spec
6-
- Dilithium Signature generation and verification
6+
- Signature generation and verification
77
- OTP encryption using Kyber key exchange
88
- Hash chain tamper detection
99
"""
1010

11-
import pytest
1211
from core.crypto import (
1312
generate_kem_keys,
1413
generate_sign_keys,
@@ -29,7 +28,13 @@
2928
ML_DSA_87_NAME,
3029
ML_DSA_87_SK_LEN,
3130
ML_DSA_87_PK_LEN,
32-
ML_DSA_87_SIGN_LEN
31+
ML_DSA_87_SIGN_LEN,
32+
33+
CLASSIC_MCELIECE_8_F_NAME,
34+
CLASSIC_MCELIECE_8_F_SK_LEN,
35+
CLASSIC_MCELIECE_8_F_PK_LEN,
36+
CLASSIC_MCELIECE_8_F_CT_LEN
37+
3338
)
3439
from core.trad_crypto import sha3_512
3540

@@ -65,6 +70,26 @@ def test_mlkem_keygen_basic():
6570
seen_public_keys.add(public_key)
6671

6772

73+
def test_mceliece_keygen_basic():
74+
"""Validate ML-KEM-1024 key generation: uniqueness, type, and length."""
75+
seen_private_keys = set()
76+
seen_public_keys = set()
77+
78+
for _ in range(10):
79+
private_key, public_key = generate_kem_keys(CLASSIC_MCELIECE_8_F_NAME)
80+
81+
assert private_key not in seen_private_keys, "Duplicate private key detected"
82+
assert public_key not in seen_public_keys, "Duplicate public key detected"
83+
84+
assert private_key != public_key, "Private and public keys must differ"
85+
assert isinstance(private_key, bytes) and isinstance(public_key, bytes), "Keys must be bytes"
86+
assert len(private_key) == CLASSIC_MCELIECE_8_F_SK_LEN, "Private key length mismatch with spec"
87+
assert len(public_key) == CLASSIC_MCELIECE_8_F_PK_LEN,, "Public key length mismatch with spec"
88+
89+
seen_private_keys.add(private_key)
90+
seen_public_keys.add(public_key)
91+
92+
6893
def test_mldsa_keygen_basic():
6994
"""Validate ML-DSA-87 key generation: uniqueness, type, and length."""
7095
seen_private_keys = set()

0 commit comments

Comments
 (0)