Member-only story
Signal-Style Double Ratchet (part 2 of ?)
Disclaimer: I’m new to cryptography and am not a cryptographic expert. I don’t have any certifications on the topic; this is just self-study to try to replicate something (similar to, not guaranteed at all to be the same) as what Signal is talking about in their blog posts. This code will get refactored, improved and changed a lot over time. Presently it’s for demo purposes and pretty insecure.
I went ahead and attempted to add some “quantum hard” encryption to the example from my previous post. Obviously there are a lot of things I haven’t done yet to harden this. This system can’t currently handle missed messages, is missing some hardening features, and is generally insecure. But it does employ “quantum-hard” (for now) encryption, and I added signing to messages passed along this time as well.
I have also done a bit of refactoring, although it still needs more work. Some of the long functions are a bit confusing.
I will go ahead and set up a codeberg account and start putting this and other files there so it’s easier for people to pick over.
from cryptography.fernet import Fernet, MultiFernet
import oqs
import os
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
kemalg =…







