3.1 Public Key Cryptography in Onion Ecosystems
Public Key Cryptography (PKC) is the mathematical backbone of onion networks such as Tor, I2P, and modern mixnets.
Without public key systems, anonymity networks could not securely establish trust, negotiate session keys, authenticate services, or protect identities in hostile environments.
This chapter explains what role public key cryptography plays, where it is used, and why onion ecosystems depend on it, using accepted cryptographic and networking literature.
A. Why Public Key Cryptography Is Essential to Onion Networks
Section titled “A. Why Public Key Cryptography Is Essential to Onion Networks”Onion networks operate in an environment where:
-
participants do not trust each other
-
nodes are run by volunteers
-
adversaries may control parts of the network
-
communication paths change frequently
Public key cryptography solves four fundamental problems:
-
Secure key exchange over untrusted networks
-
Authentication without revealing identity
-
Self-authenticating service addresses
-
Forward secrecy for past communications
Without PKC, onion routing would collapse into either:
-
insecure plaintext routing, or
-
centralized trust authorities (which anonymity networks avoid)
B. Core Concept: Public Key vs Private Key (Quick Refresher)
Section titled “B. Core Concept: Public Key vs Private Key (Quick Refresher)”Public key cryptography uses a key pair:
-
Public key
-
Shared openly
-
Used to encrypt data or verify signatures
-
-
Private key
-
Kept secret
-
Used to decrypt data or create signatures
-
In onion ecosystems, public keys replace real-world identity.
A cryptographic key is the identity.
C. Where Public Key Cryptography Is Used in Onion Networks
Section titled “C. Where Public Key Cryptography Is Used in Onion Networks”Public key cryptography appears at multiple architectural layers.
1. Relay Identity Authentication
Section titled “1. Relay Identity Authentication”Each relay in Tor has:
-
a long-term identity key
-
a signing key
-
short-term onion keys
These keys allow:
-
verification that a relay is genuine
-
protection against relay impersonation
-
secure relay-to-relay communication
Relays publish signed descriptors so clients can verify authenticity without knowing who operates the relay.
2. Circuit Key Negotiation (Client ↔ Relay)
Section titled “2. Circuit Key Negotiation (Client ↔ Relay)”When a Tor client builds a circuit:
-
It retrieves relay public keys
-
It performs a Diffie–Hellman key exchange with each relay
-
A unique symmetric session key is created per hop
Public key cryptography is used only to bootstrap trust.
After that, faster symmetric cryptography takes over.
This design balances:
-
strong security
-
acceptable performance
3. Onion Encryption Layers
Section titled “3. Onion Encryption Layers”Each encryption layer corresponds to a different relay’s public key.
Conceptually:
-
Outer layer → guard relay public key
-
Middle layer → middle relay public key
-
Inner layer → exit relay public key
Each relay can decrypt only its own layer, because only it holds the corresponding private key.
This layered PKC structure is what makes onion routing possible.
4. Onion Services (.onion) Identity
Section titled “4. Onion Services (.onion) Identity”In Tor v3 onion services:
-
the .onion address is derived from a public key
-
the address itself is a cryptographic commitment
This is known as self-authenticating naming.
Implications:
-
no DNS authority
-
no certificate authority
-
no third-party trust
-
phishing resistance (you cannot fake a key-derived address)
Public key cryptography replaces the entire web PKI model.
D. Cryptographic Algorithms Used in Onion Ecosystems
Section titled “D. Cryptographic Algorithms Used in Onion Ecosystems”Different onion networks use different algorithms, but all follow modern cryptographic standards.
1. RSA (Legacy, Mostly Deprecated)
Section titled “1. RSA (Legacy, Mostly Deprecated)”-
Used in early Tor (v2 hidden services)
-
1024-bit RSA is now considered weak
-
Replaced due to performance and security concerns
2. Elliptic Curve Cryptography (ECC)
Section titled “2. Elliptic Curve Cryptography (ECC)”Modern onion systems prefer ECC because it offers:
-
shorter keys
-
faster computation
-
equivalent or stronger security
Examples:
-
Curve25519 (key exchange)
-
Ed25519 (signatures)
Tor v3 onion services rely heavily on Ed25519.
3. Diffie–Hellman Key Exchange
Section titled “3. Diffie–Hellman Key Exchange”Used to:
-
establish shared secrets
-
ensure Perfect Forward Secrecy (PFS)
Even if a private key is compromised later, past sessions remain secure.
4. Digital Signatures
Section titled “4. Digital Signatures”Used to:
-
authenticate relays
-
sign directory information
-
validate onion service descriptors
Signatures prove authenticity, not identity.
E. Trust Model: Cryptography Instead of Identity
Section titled “E. Trust Model: Cryptography Instead of Identity”Onion networks deliberately avoid:
-
usernames
-
passwords
-
government identity
-
real-world attribution
Instead, trust is established through:
-
cryptographic proofs
-
signed data structures
-
consensus documents
This model is called trust by verification, not trust by authority.
F. Public Key Cryptography vs Traditional Web Security
Section titled “F. Public Key Cryptography vs Traditional Web Security”| Aspect | Traditional Web (HTTPS) | Onion Ecosystems |
|---|---|---|
| Identity | Domain names + certificates | Public keys |
| Trust Anchor | Certificate Authorities | Cryptographic math |
| Revocation | CA-based | Key rotation |
| Naming | DNS | Self-authenticating |
| Failure Mode | CA compromise | Isolated key compromise |
Onion ecosystems intentionally remove centralized trust points.
G. Security Properties Achieved Through PKC
Section titled “G. Security Properties Achieved Through PKC”Public key cryptography enables onion networks to achieve:
-
Confidentiality — encrypted communication
-
Authentication — verifying relays and services
-
Integrity — data cannot be altered unnoticed
-
Forward Secrecy — past traffic remains protected
-
Unlinkability — identity separated from routing
These properties are repeatedly validated in academic security analysis.
H. Limitations and Challenges
Section titled “H. Limitations and Challenges”Despite its strengths, PKC introduces challenges:
-
Computational cost
Public key operations are slower than symmetric crypto. -
Key management complexity
Rotation, expiration, and revocation must be handled carefully. -
Post-Quantum Threats
Future quantum computers could break some public key schemes.
This is why modern onion ecosystems are exploring post-quantum cryptography, discussed in later chapters.
I. Why Public Key Cryptography Is Non-Negotiable
Section titled “I. Why Public Key Cryptography Is Non-Negotiable”Onion ecosystems cannot rely on:
-
shared secrets
-
pre-established trust
-
centralized authorities
Public key cryptography is the only scalable solution that allows:
-
anonymous participation
-
decentralized trust
-
cryptographic identity
-
resistance to surveillance
It is the foundation upon which every higher-layer anonymity mechanism is built.