Skip to content
Mermaid templates

RSA Key Exchange

RSA-based encrypted message exchange between two parties.

Template previewMermaid
Rendering…

Make it your own.

sequenceDiagram
participant A as Alice
participant B as Bob

Note over A: pick p, q primes\nn = p·q, φ(n) = (p-1)(q-1)\npick e coprime to φ(n)\nd = e⁻¹ mod φ(n)
A->>B: public key (n, e)
B->>A: c = m^e mod n  (encrypted)
Note over A: m = c^d mod n  (decrypt)
A-->>B: ACK
Note over A,B: Only Alice has d → only she can decrypt