In the 20th century, theoretical computer science primarily centered on sequential computation models. However, the advent of global networking has shifted the paradigm, presenting new challenges related to communication, cooperation, and security in distributed systems. Understanding computing in this networked world is a central task for modern computer science.
This chapter delves into two critical aspects of networked computing: communication complexity and cryptography. While communication complexity studies the minimal resources (e.g., bits exchanged) required for distributed tasks, cryptography focuses on enabling secure communication in the presence of adversaries. Cryptography, in particular, relies heavily on the concepts of complexity theory, algorithmics, and randomization that we explored in previous chapters. It offers counterintuitive solutions that allow for secure interactions even over insecure channels. (For instance, how can two parties agree on a secret key without ever meeting, or how can you prove you know something without revealing what it is?)
We will begin by examining classical cryptosystems and their inherent weaknesses, which led to the revolutionary idea of public-key cryptography. We will then explore the widely used RSA cryptosystem in detail, understanding its mathematical foundations and security assumptions. Following this, we will discuss digital signatures and authentication protocols, which are crucial for verifying identity and message integrity. The chapter will also introduce interactive proof systems and zero-knowledge proofs, powerful tools for verifying knowledge without revealing it. Finally, we will touch upon the design of efficient communication networks, exemplified by Beneš networks.
9.1 Aims
By the end of this chapter, you will be able to:
- Understand Cryptosystem Fundamentals: Grasp the basic components and requirements of a cryptosystem, including plaintext, ciphertext, and keys.
- Differentiate Symmetric and Asymmetric Cryptography: Understand the key distribution problem in classical (symmetric) systems and how public-key (asymmetric) cryptography solves it.
- Comprehend One-Way Functions: Learn the properties of one-way functions and their role as the foundation of public-key cryptography.
- Master RSA Encryption: Understand the key generation, encryption, and decryption processes of the RSA algorithm, along with its mathematical proof of correctness.
- Design Digital Signatures: Learn how public-key cryptography enables secure digital signatures and authentication.
- Explore Interactive Proofs: Understand the concept of interactive and zero-knowledge proof systems and their applications.
- Analyze Communication Networks: Gain insight into the design principles and optimality of communication networks like Beneš networks.
9.2 Classical Cryptosystems
Cryptology is the study of secret communication. It comprises cryptography (the design of secure systems) and cryptanalysis (the art of breaking them). Here, we focus on cryptography.
The basic scenario involves a sender who wants to send a secret plaintext message to a receiver. To prevent an unauthorized eavesdropper from reading the message, it is sent in an encrypted form, called ciphertext. The encryption and decryption processes are governed by a key.
Definition 9.1 (Cryptosystem)
A cryptosystem is a triple , where:
- is the set of all possible plaintexts.
- is the set of all possible ciphertexts.
- is the set of all possible keys. Each key defines an injective encryption function and its inverse decryption function .
Requirements for a Cryptosystem:
- and must be efficiently computable.
- Without knowing , it must be computationally infeasible to compute the plaintext from a given ciphertext .
The Caesar Cipher
The simplest cryptosystem is the Caesar cipher. For a plaintext over the Latin alphabet, each letter is replaced by a letter shifted positions forward (cyclically). The key .
Caesar Cipher
Plaintext:
KRYPTOGRAPHIEISTFASZINIERENDKey: Ciphertext:NUBSWRJUDSKLHLVWIDVCLQLHUHQG
Weakness: This system is easily broken by trying all 26 possible keys (brute-force attack) or by using frequency analysis of letters in the language. (With so few keys, a modern computer can crack it in milliseconds.)
The Key Distribution Problem
Classical cryptosystems are symmetric: the same key is used for both encryption and decryption (or one can be easily derived from the other). This means the sender and receiver must share a common secret key. The fundamental problem is: How do Alice and Bob securely agree on this shared secret key over an insecure channel? (If they can’t meet in person to exchange the key, any communication channel they use could be eavesdropped upon, compromising the key before it’s even used.) This is the key distribution problem, and it remained a major hurdle for centuries.
9.3 Public-Key Cryptosystems and RSA
The revolutionary idea of public-key cryptography (also known as asymmetric cryptography) emerged in the 1970s, solving the key distribution problem. It relies on one-way functions.
Definition 9.1 (One-Way Function)
A function is a one-way function if it satisfies the following properties: (Think of it like breaking a glass: easy to do, but practically impossible to reassemble perfectly.)
- Efficiently Computable: can be computed in polynomial time.
- Hard to Invert: For any randomized polynomial-time algorithm , the probability that can compute from is negligibly small.
- Trapdoor: There exists secret information (a “trapdoor”) that makes efficiently computable.
Candidates for One-Way Functions:
- Integer Factorization: Multiplication of two large primes is easy; factoring their product is believed to be hard. (There is no known polynomial-time algorithm for factoring large numbers on classical computers, making it a suitable candidate for a one-way function.)
- Discrete Logarithm: Exponentiation modulo a prime is easy; finding the exponent (discrete logarithm) is believed to be hard.
The RSA Cryptosystem
The RSA cryptosystem, named after Rivest, Shamir, and Adleman, is the most widely used public-key cryptosystem. Its security relies on the presumed difficulty of factoring large numbers.
Key Generation (by Receiver Bob):
- Choose two large random prime numbers, and (e.g., each hundreds of bits long).
- Compute . This is part of the public key.
- Compute Euler’s totient function .
- Choose an integer (the public exponent) such that and .
- Compute the integer (the private exponent) such that . This is the trapdoor.
- Public Key: (published for anyone to use for encryption).
- Private Key: (kept secret by Bob; are also kept secret).
Encryption (by Sender Alice): To encrypt a plaintext message (represented as an integer ):
Decryption (by Receiver Bob): To decrypt a ciphertext :
Both exponentiation operations ( and ) can be computed efficiently using the repeated squaring method (as seen in Chapter 8). (This method reduces the number of multiplications from to , which is critical for large exponents.)
Correctness of RSA
The correctness of RSA relies on Euler’s Theorem, a generalization of Fermat’s Little Theorem.
Theorem 9.1 (Euler's Theorem)
Let and be two positive integers with . Then .
Theorem 9.2 (Correctness of RSA)
Let p, q, n, e, d be determined as in RSA. Then for all integers w such that :
Proof of RSA Correctness
From the key generation, , which means for some integer . We need to show .
Case 1: . By Euler’s Theorem, . So .
Case 2: . This means is a multiple of or (or both). Without loss of generality, assume divides . Since is prime and , cannot divide (unless ).
- Since divides , . Thus .
- Since does not divide , . By Fermat’s Little Theorem, . Since , . So . We have (since both are 0 mod p) and . By the Chinese Remainder Theorem, this implies , i.e., .
The case is trivial: .
Security: The security of RSA relies on the computational difficulty of factoring into and . If an adversary can factor , they can compute and then , thus breaking the encryption.
9.4 Digital Signatures
Digital signatures provide authenticity and integrity for electronic documents, analogous to handwritten signatures.
Requirements for Digital Signatures:
- Authenticity: The receiver must be convinced that the signature is from the sender.
- Non-repudiation: The sender cannot later deny having signed the document.
- Integrity: The document has not been altered since it was signed.
- Unforgeability: No one else can forge the sender’s signature.
Protocol for Digital Signatures (using RSA)
Alice wants to sign a document for Bob. Alice has her own RSA key pair: public key and private key . Bob knows Alice’s public key.
- Alice computes a hash of the document . (A hash function produces a fixed-size “fingerprint” of the document. Even a tiny change to the document results in a completely different hash, making it a reliable integrity check.)
- Alice “signs” the hash: .
- Alice sends to Bob.
Verification (by Bob):
- Bob computes from the received document.
- Bob “decrypts” the signature: .
- Bob checks if . If they match, the signature is valid.
Why it works:
- Only Alice knows , so only she could have produced such that . This ensures authenticity and non-repudiation. (Even Bob, the receiver, cannot forge Alice’s signature because he only knows her public key , not her private key .)
- Any alteration to would result in a different , which would not match , ensuring integrity.
9.5 Interactive Proof Systems and Zero-Knowledge Proofs
In Chapter 6, we learned that problems in NP have polynomial-time verifiers. This means a “yes” answer to an NP problem can be accompanied by a short, efficiently checkable proof. Interactive proof systems generalize this idea, allowing a prover (P) to convince a verifier (V) of a statement’s truth through a series of interactions, possibly involving randomness.
Definition 9.2 (Interactive Proof System)
A language has an interactive proof system if there exists a randomized polynomial-time verifier such that for all : (Imagine a powerful “prover” trying to convince a computationally limited “verifier” of a mathematical truth.)
- Completeness: If , there exists a prover such that accepts with probability greater than after interacting with . (The specific constants and are arbitrary; any constants strictly greater than and strictly less than respectively would work, as the probabilities can be amplified by repetition.)
- Soundness: If , then for any prover , accepts with probability less than after interacting with .
The probabilities and are arbitrary constants; they can be amplified arbitrarily close to 1 and 0 by repeating the interaction.
Example: Graph Non-Isomorphism
The Graph Isomorphism problem (GI) asks if two graphs are structurally identical. It is in NP. Its complement, Graph Non-Isomorphism (NONISO), asks if are not isomorphic. It is not known if NONISO is in NP. However, NONISO has an interactive proof system.
Interactive Proof for NONISO
Input:
- Verifier V: a. Randomly chooses and a random permutation of the vertices. b. Computes (a randomly relabeled version of ). c. Sends to Prover P.
- Prover P: a. Receives . P (with unlimited computational power) determines if is isomorphic to or . b. Sends back to V, indicating which original graph is isomorphic to.
- Verifier V: a. Checks if . If so, V accepts. Otherwise, V rejects.
Why it works:
- Completeness (if are non-isomorphic): An honest P knows which graph came from and always sends . V always accepts.
- Soundness (if are isomorphic): If are isomorphic, then is isomorphic to both and . P cannot distinguish whether came from or . P must guess . P’s guess is correct with probability . By repeating the protocol times, the probability of a dishonest P fooling V drops to .
IP = PSPACE
A remarkable result by Shamir (1990) shows the immense power of interactive proofs:
Theorem 9.3 (Shamir's Theorem)
The class of languages with interactive proof systems (IP) is equal to PSPACE. This means that even problems requiring polynomial space (which can be exponentially larger than polynomial time) can have their proofs verified efficiently through interaction and randomness.
Zero-Knowledge Proof Systems
A zero-knowledge proof (ZKP) is an interactive proof system with an additional, crucial property: the verifier learns nothing from the interaction beyond the fact that the statement is true. The verifier cannot use the interaction to convince a third party, nor does it gain any information about the secret itself. (Imagine proving to someone that you know a secret password without actually telling them the password.)
Zero-Knowledge Proof for Graph Isomorphism
Input: . Prover P wants to convince Verifier V that without revealing the isomorphism.
- Prover P: a. Randomly chooses a permutation and computes . b. “Commits” to (e.g., by encrypting it or using a cryptographic hash) and sends the commitment to V.
- Verifier V: a. Randomly chooses . b. Sends to P (this is the “challenge”).
- Prover P: a. “Opens” the commitment to . b. If , P sends (the permutation that maps to ). c. If , P sends (the permutation that maps to , where ).
- Verifier V: a. Checks if (if ) or (if ).
If , P can always answer correctly. If , P cannot produce a valid that is isomorphic to both and . The zero-knowledge property comes from the fact that V only sees a random isomorphic copy and a random permutation, which V could have generated itself.
ZKP systems have significant practical applications in authentication (proving identity without revealing a password), anonymous credentials, and secure multi-party computation.
9.6 Design of a Communication Network
Designing efficient communication networks is a complex task, balancing cost, performance, and scalability. We consider the problem of building an -permutation network. (This is a network designed to efficiently route messages between senders and receivers, where any sender can connect to any receiver, and all connections can happen simultaneously without interference.)
Problem: Connect “x-participants” () to “y-participants” () such that any permutation of connections (i.e., wants to talk to for all ) can be realized simultaneously with edge-disjoint paths.
A simple solution is a complete bipartite graph, connecting every to every . This requires edges, which is too costly and complex for large . We need networks with a constant maximum degree for each node.
We measure the cost of a permutation network by the number of switching nodes (nodes that are not participants) and the length of the longest path.
Theorem 9.4
Every n-permutation network must have at least switching nodes.
Proof of Lower Bound for Permutation Networks
Let be the number of switching nodes. Each switching node can be in one of a constant number of states (e.g., 2 states for a simple switch). The participant nodes also have states. The total number of possible state assignments in the network must be at least (the number of permutations). If each of the switching nodes has 2 states, and each of the participant nodes has 2 states, then . Taking of both sides: . Using Stirling’s approximation for : .
Beneš Networks
Beneš networks are a class of asymptotically optimal permutation networks. An -dimensional Beneš network, , can realize any -permutation.
The construction is recursive: is built from two networks and two “layers” of switches.
Theorem 9.5
For each , is a -permutation network.
Proof of Beneš Network Permutation Property
The proof is by induction on . It shows that for any permutation, paths can be routed through the network such that they are edge-disjoint. The recursive structure allows for a divide-and-conquer routing strategy.
A network for participants has switching nodes. This is switching nodes, matching the lower bound. (This means you can’t build a permutation network with significantly fewer switching nodes, making Beneš networks theoretically as efficient as possible in terms of hardware.) The length of the longest path is , which is . Beneš networks are highly modular and regular, making them practical for construction.
Summary
- Cryptography enables secure communication over insecure channels, relying heavily on complexity theory and randomization.
- Classical (symmetric) cryptosystems suffer from the key distribution problem, as sender and receiver must share a secret key.
- Public-key (asymmetric) cryptosystems solve this by using one-way functions with trapdoors, allowing public encryption keys and private decryption keys.
- RSA is a prominent public-key cryptosystem whose security is based on the difficulty of integer factorization. Its correctness is proven using Euler’s Theorem.
- Digital signatures use public-key cryptography to provide authenticity, non-repudiation, and integrity for electronic documents.
- Interactive proof systems allow a prover to convince a verifier of a statement’s truth through interaction, even for problems in PSPACE.
- Zero-knowledge proof systems are interactive proofs where the verifier learns nothing beyond the truth of the statement.
- Communication networks like Beneš networks provide asymptotically optimal solutions for realizing any permutation of connections between participants, with switching nodes and path length.
Previous Chapter: Chapter 8 - Randomization Next Up: Chapter 10 - Grammars and Chomsky Hierarchy
Exercises
Exercise 9.1 (Caesar Cipher Decryption)
Decrypt the ciphertext
NUBSWRJUDSKLHLVWIDVCLQLHUHQGif you know it was encrypted with a Caesar cipher and the plaintext is in English.Solution
By trying all 25 possible shifts (or using frequency analysis, where ‘U’ is the most frequent letter in the ciphertext, likely corresponding to ‘E’ in English), we find that a shift of 3 positions backward (or 23 forward) decrypts the message. Plaintext:
KRYPTOGRAPHIEISTFASZINIEREND
Exercise 9.2 (RSA Key Generation and Usage)
Bob chooses and .
Calculate and .
Choose a suitable public exponent .
Calculate the private exponent .
Encrypt the message .
Decrypt the resulting ciphertext.
Solution
- . .
- Choose such that and . Let’s pick .
- Calculate such that . . We can use the Extended Euclidean Algorithm or test values. . So .
- Public key: . Private key: . Encrypt : . , so .
- Decrypt : . This is a bit tedious by hand, but using repeated squaring: . The original message is recovered.
Exercise 9.3 (Digital Signature Authentication)
Design a communication protocol for digital signatures that fulfills the following requirements:
Bob must be convinced of Alice’s authenticity.
Alice should be protected from Bob forging her signature.
No third party eavesdropping on the communication may learn the content of the signed document.
Solution
Alice has RSA keys (public) and (private). Bob has RSA keys (public) and (private).
- Alice computes (hash of document ).
- Alice signs : .
- Alice encrypts and with Bob’s public key: and .
- Alice sends to Bob.
Verification (by Bob):
Bob decrypts and : and .
Bob computes .
Bob verifies Alice’s signature: .
Bob checks if . If they match, the signature is valid and the message is authentic.
- Authenticity/Non-repudiation: Only Alice could have created .
- Protection from Bob: Bob cannot forge Alice’s signature for another document because he doesn’t know .
- Confidentiality: Only Bob can decrypt and using his private key .
Exercise 9.4 (Beneš Network Properties)
For an -dimensional Beneš network (which handles participants):
How many switching nodes does it have?
What is the length of the longest path between an x-participant and a y-participant?
Solution
- A network has stages of switches, and each stage has switching nodes. So, the total number of switching nodes is . For participants, this is , which is .
- The length of the longest path (number of switching nodes traversed) is . For participants, , so the path length is , which is .