AI video/img LSB watermarking security layer using RSA-2048 and stenography
Built a dual-layer security system for a deepfake application using invisible LSB watermarking, RSA-2048 digital signatures, and a stenography module to embed cryptographic metadata into image pixels surviving JPEG compression. Developed PKI infrastructure with automated key generation, AES-256 encrypted private keys, and signature verification tools; containerized the ML pipeline with Docker for cross-platform use.
Case Study
Problem
Deep-fake video tools generate convincing synthetic content with no built-in provenance. Add an authentication layer that lets anyone verify whether a frame was produced by a specific model instance.
Architecture
- LSB steganography module embedding cryptographic metadata invisibly into pixel channels
- Compression-resistant payload design (survives JPEG re-encode up to ~85% quality)
- RSA-2048 digital signature generation and verification using Python cryptography library
- AES-256-CBC encrypted private key storage for PKI key material
- CLI tools for key generation, signing, and verification
- ONNX Runtime + InsightFace + OpenCV + PyTorch ML pipeline; Docker-containerised for portability
Challenges
- Ensuring LSB payload survived JPEG compression (chose bit planes 0–1 and channel weighting)
- Keeping RSA signature generation below 40 ms per frame at 30 fps
- Designing a key-derivation scheme that is reproducible yet resistant to brute force
- Cross-platform Docker image for both CPU (x86) and GPU (CUDA) inference
Tradeoffs
- LSB steganography is invisible but fragile against aggressive re-encoding; balanced by targeting bit planes least affected by DCT
- RSA-2048 chosen over ECDSA for wider tooling compatibility despite larger key size
- Closed-source to protect proprietary watermarking algorithm design
Outcome
Dual-layer security system passed all synthetic test cases; watermark survived JPEG compression at 85% quality and signatures verified end-to-end.
What I Learned
- How LSB steganography interacts with DCT-based compression codecs
- Python cryptography library internals: RSA, AES key derivation, padding schemes
- ONNX Runtime inference optimisation for real-time video pipelines
- PKI design patterns: certificate chains, key revocation, and secure storage