Keyed masking for secure multi-user semantic communication

Reproducibility package for the TIFS submission: transmit and receive
core, security stages (eavesdropper, jamming, key families, attack
difficulty, known-plaintext), real BERT token streams, closed-form
verification, and the scripts that regenerate every figure and table
from the released CSVs.
This commit is contained in:
KiHoLee
2026-08-13 21:01:32 +09:00
commit 37392bc38f
34 changed files with 2293 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
# Keyed Masking for Secure Multi-User Semantic Communication
Reproducibility package for the manuscript *Mask-as-Key Secure Multiple
Access for Semantic Communications: Physical-Layer Encryption and
Jamming Robustness*, submitted to the IEEE Transactions on Information
Forensics and Security.
Every figure and table in the paper is regenerated from this
repository. Experiment scripts write CSV files to `data/` and never
draw; `replot_security.py` reads only `data/` and writes the figure PDFs
to `fig/`; `make_tables.py` prints the LaTeX rows of the result tables.
## Idea
Multi-user semantic communication superposes several users on one frame
and multiplies each user embedding by a distinct pattern so that the
receivers can separate them. This code treats that pattern as a secret
key. One keyed operation then encrypts each user against a receiver
without the key, separates the users, and spreads a jammer that does not
hold the key, at no extra bandwidth, power, or rate.
## Layout
```
code/
sse_lib.py transmit and receive core, channel, training, OMA reference
exp_full.py stages A-F: SNR sweep, key length, jamming, key families,
scheme comparison, attack difficulty
exp_kpa.py stage H: known-plaintext attack on the key
exp_real_sec.py stage G: real BERT WordPiece token streams
verify_math.py closed-form checks V1-V5 against Monte Carlo, PASS/FAIL
replot_security.py every result figure, from data/ to fig/
make_tables.py LaTeX rows of the two result tables, from data/
feasibility_security.py early CPU-sized study, kept for the record
data/ CSV results, one file per stage
fig/ figure PDFs, regenerated by replot_security.py
```
## Reproducing
Requires Python 3, PyTorch, NumPy, and Matplotlib. The real-token stage
additionally needs `datasets` and `transformers`. A CUDA device is
recommended; the code falls back to CPU. Under Windows install PyTorch
in WSL, because the native Windows build does not load the CUDA
libraries.
```bash
python verify_math.py # closed-form verification, prints PASS/FAIL
python exp_full.py # stages A-F
python exp_kpa.py # known-plaintext attack
python exp_real_sec.py # real token streams
python replot_security.py # all figures from the CSVs
python make_tables.py # LaTeX rows of the result tables
```
Seeds are fixed: training 1, evaluation 777, attacker key guess
20260813. Re-running reproduces the released CSV files.
## Figure and table map
| Artifact | Script | Data |
|---|---|---|
| Fig. 2 SER against SNR | `exp_full.stage_A` | `sec_snr.csv` |
| Fig. 3 key length | `exp_full.stage_B` | `sec_keylen.csv` |
| Fig. 4 jamming | `exp_full.stage_C` | `sec_jam.csv` |
| Fig. 5 key sensitivity | `exp_full.stage_F` | `sec_sens.csv` |
| Fig. 6 brute-force search | `exp_full.stage_F` | `sec_brute.csv` |
| Fig. 7 known-plaintext attack | `exp_kpa` | `kpa.csv` |
| Fig. 8 real token streams | `exp_real_sec` | `real_sec_ter.csv` |
| Scheme comparison table | `exp_full.stage_E` | `sec_compare.csv` |
| Key family table | `exp_full.stage_D` | `sec_maskfam.csv`, `sec_regjam.csv` |
| Headline recovery table | `exp_real_sec` | `real_sec_stats.json` |
## Security scope
The analysis covers an adversary that observes transmitted frames. The
masking is linear, so an adversary that also learns the indices some
frames carried recovers the key from a few frames, which `exp_kpa.py`
measures. The key must therefore be refreshed per coherence block from
a shared seed, as the paper states. This repository implements the
measurement of that limit, not a key-refresh layer.
## License
MIT for the code. The AG News data and the language-model tokenizer are
obtained from their own sources under their own terms.