Cryptography Final Exam Key Problems - English Version
Problem Type Description
This problem set contains four exam question types:
- Concept Explanation: Explain cryptographic concepts, definitions, properties, etc.
- Scheme Design: Design cryptographic schemes to meet specific security requirements
- Proof Problems: Prove security or insecurity of cryptographic schemes
- Calculation Problems: Perform specific cryptographic calculations
Part 1: Symmetric Tools
Type 1: Concept Explanation
Problem 1: Explain PRG Security Definition
Problem: Please explain in detail the security definition of Pseudo-Random Generator (PRG), including: (1) Formal definition (2) Concept of distinguisher (3) Meaning of negligible function (4) Why this definition ensures PRG security
Complete Solution:
(1) Formal Definition
Let be a function where (expansion requirement). is a secure PRG if for all polynomial-time distinguishers , there exists a negligible function such that: where:
- is a random seed
- is a truly random string
- is a distinguisher algorithm that outputs 0 or 1
(2) Concept of Distinguisher
A distinguisher is a polynomial-time algorithm that attempts to distinguish PRG output from a truly random string:
- If outputs 1, it means it thinks the input is random
- If outputs 0, it means it thinks the input is not random (possibly PRG output)
The distinguisher's goal is to maximize distinguishing advantage:
(3) Meaning of Negligible Function
A negligible function satisfies: for all polynomials , there exists such that for all , we have .
Intuitive understanding: A negligible function decays faster than the reciprocal of any polynomial. For example:
- is negligible
- is negligible
- is not negligible (because for large )
(4) Why This Definition Ensures PRG Security
If PRG is secure, then:
- Any polynomial-time algorithm cannot distinguish from a truly random string with non-negligible advantage
- This means is computationally indistinguishable from a truly random string
- Therefore, using instead of a truly random string does not significantly reduce security
- This ensures PRG can be safely used in cryptographic applications (e.g., generating key streams)
If there exists a distinguisher that can distinguish with non-negligible advantage, then PRG is insecure and cannot be used in cryptographic applications.
Problem 2: Explain the Role of IV in Stream Cipher
Problem: In stream ciphers, what is the role of Initialization Vector (IV)? Why does IV not need to be secret? What security problems occur if the same combination of key and IV is reused? Please explain in detail.
Complete Solution:
Role of IV
The Initialization Vector (IV) in stream ciphers has the following roles:
-
Ensures Uniqueness of Key Stream: Even with the same key , different IVs produce different key streams
- Key stream:
- If , then (for secure PRG)
-
Prevents Same Plaintext from Producing Same Ciphertext:
- If is different, even if plaintext is the same, ciphertext will be different
- This provides semantic security
-
Supports Parallel Encryption: Different messages can use different IVs, enabling parallel encryption
Why IV Does Not Need to Be Secret
Reasons why IV does not need to be secret:
-
IV's Role is to Provide Randomness, Not Confidentiality:
- Confidentiality is provided by key and encryption function
- IV's role is to ensure each encryption produces different ciphertexts
-
Even if Attacker Knows IV, Stream Cipher Remains CPA Secure as Long as IV is Random:
- Attacker knows and
- But without knowing key , cannot compute
- Therefore cannot obtain information about plaintext
-
Practical Considerations:
- IV is usually transmitted together with ciphertext
- Can be stored publicly
- But must ensure IV uniqueness (cannot be reused)
Security Problems from Reusing Same Key and IV
If the same combination of key and IV is reused, serious security problems occur:
Attack Scenario: Assume using the same to encrypt two messages and :
Attack Method: Attacker can compute:
Security Consequences:
- Leaks XOR of Plaintexts: Attacker obtains , which leaks the XOR of two plaintexts
- If One Plaintext is Known, Can Recover the Other:
- If attacker knows , then
- Pattern Analysis: Attacker can analyze patterns in plaintexts
Practical Example: If and , attacker computing may leak partial information.
Conclusion:
- Absolutely forbidden to reuse the same combination
- Each encryption must use a different IV
- IV can be a counter, random number, or timestamp, but must ensure uniqueness
Type 2: Scheme Design
Problem 3: Design a Secure File Transfer Scheme
Problem: Design a secure file transfer scheme that satisfies the following requirements:
- File size is 10GB (very large)
- Payment information is confidential (No one knows the payment amount)
- File integrity (Integrity)
- Only Bob can check the file content
Please: (1) Choose appropriate cryptographic tools (2) Explain the scheme's working process in detail (3) Explain how the scheme satisfies each requirement
Complete Solution:
(1) Choose Appropriate Cryptographic Tools
Based on requirements, we need the following tools:
- Symmetric Encryption: For encrypting large files (efficient)
- Public Key Encryption: For transmitting symmetric key (only Bob can decrypt)
- Hash Function: For file integrity verification
- Digital Signature (optional): For authenticating sender identity
Specific Choices:
- Symmetric Encryption: AES-256-CTR (suitable for large files, supports parallelization)
- Public Key Encryption: RSA-OAEP or Elgamal (for encrypting symmetric key)
- Hash Function: SHA-256 (for integrity)
- Digital Signature: RSA-FDH or Schnorr (for authentication)
(2) Detailed Scheme Design
Scheme: Hybrid Encryption + Hash + Digital Signature
Step 1: Sender (Alice) Prepares File
- Generate random symmetric key: (AES-256 key)
- Choose random IV:
- Encrypt file using AES-CTR:
- Split 10GB file into blocks:
- Encrypt each block:
- Ciphertext file:
- Compute file hash: (compute for entire original file)
- Encrypt symmetric key using Bob's public key:
- (Optional) Sign hash value using Alice's private key:
Step 2: Send Alice sends to Bob:
- Encrypted file: (10GB)
- Encrypted key:
- File hash value:
- (Optional) Signature:
Step 3: Receiver (Bob) Verifies and Decrypts
- Decrypt key using Bob's private key:
- Decrypt file using AES-CTR:
- Decrypt each block:
- Recover file:
- Compute hash of received file:
- Verify integrity: Check if
- If equal, file is intact; otherwise file has been tampered with
- (Optional) Verify signature:
(3) Explain How Each Requirement is Satisfied
Requirement 1: File Size is 10GB (Very Large)
- Solution: Use symmetric encryption (AES-CTR)
- Symmetric encryption is fast, suitable for large files
- CTR mode supports parallel encryption/decryption
- 10GB file can be processed efficiently
- Why Not Use Public Key Encryption Directly for File:
- Public key encryption is slow (100-1000 times slower than symmetric encryption)
- RSA can only encrypt data smaller than modulus
- Therefore use hybrid encryption: public key encrypts small key (256 bits), symmetric encrypts large file (10GB)
Requirement 2: Payment Information Confidential (No One Knows)
- Solution: Use public key encryption to protect symmetric key
- Only Bob has private key , only Bob can decrypt to obtain
- Without , cannot decrypt file
- Therefore, except Bob, no one can know file content (including payment information)
- Security Guarantee:
- RSA-OAEP is CPA secure
- Even if attacker intercepts , cannot decrypt (unless can break RSA)
Requirement 3: File Integrity (Integrity)
- Solution: Use hash function to verify integrity
- Alice computes hash of original file
- Bob computes hash of received file after decryption
- If , file is intact; otherwise file has been tampered with
- Security Guarantee:
- SHA-256 has collision resistance
- Attacker cannot find different files producing the same hash value
- Therefore can detect any tampering
Requirement 4: Only Bob Can Check File Content
- Solution: Use Bob's public key encryption
- Symmetric key is encrypted using Bob's public key
- Only Bob has private key , only Bob can decrypt to obtain
- Without , cannot decrypt file
- Security Guarantee:
- Public key encryption ensures only private key holder (Bob) can decrypt
- Even if attacker intercepts all transmitted data, cannot obtain file content
Scheme Summary:
- ✅ Satisfies large file requirement: Uses efficient symmetric encryption
- ✅ Satisfies confidentiality requirement: Uses public key encryption to protect key
- ✅ Satisfies integrity requirement: Uses hash function for verification
- ✅ Satisfies access control requirement: Only Bob can decrypt
Type 3: Proof Problems
Problem 4: Prove ECB Mode is Not CPA Secure
Problem: Please strictly prove that ECB (Electronic Codebook) mode is not CPA (Chosen Plaintext Attack) secure.
Requirements: (1) Give formal definition of CPA security (2) Construct attacker algorithm (3) Analyze attacker's success probability (4) Draw conclusion
Complete Solution:
(1) Formal Definition of CPA Security
Encryption scheme is CPA secure if for all polynomial-time attackers , there exists a negligible function such that:
CPA Game:
- Challenger generates key
- Attacker can query encryption oracle arbitrarily many polynomial times
- Attacker chooses two equal-length plaintexts ()
- Challenger randomly chooses , returns challenge ciphertext
- Attacker continues to query encryption oracle
- Attacker outputs
- If , attacker wins, game outputs 1; otherwise outputs 0
Attacker's Advantage:
If (negligible), then scheme is CPA secure.
(2) Construct Attacker Algorithm
ECB Mode Encryption: For message (split into blocks), ECB mode encryption is: Ciphertext:
Construction of Attacker :
Algorithm :
-
Choose Challenge Plaintexts:
- Choose two blocks and such that (e.g., , )
- Set (two identical blocks)
- Set (two different blocks)
- Send to challenger
-
Receive Challenge Ciphertext:
- Receive challenge ciphertext (two ciphertext blocks)
-
Distinguish:
- If , output
- If , output
(3) Analyze Attacker's Success Probability
Case 1: (Encrypt )
- ECB encryption: ,
- Since is deterministic function,
- Therefore
- Attacker observes , outputs
- Success: ✓
Case 2: (Encrypt )
- ECB encryption: ,
- Since and is a permutation,
- Therefore
- Attacker observes , outputs
- Success: ✓
Success Probability Analysis:
- In Case 1:
- In Case 2:
- Since is uniformly random:
- Therefore:
Attacker's Advantage:
(4) Draw Conclusion
- Attacker 's success probability is 1 (perfect distinguishing)
- Attacker's advantage is , which is non-negligible (constant, not negligible function)
- According to CPA security definition, if there exists attacker with non-negligible advantage, then scheme is not CPA secure
- Therefore, ECB mode is not CPA secure
Further Explanation:
- Problem with ECB mode: Identical plaintext blocks always produce identical ciphertext blocks
- This allows attackers to infer plaintext information by observing ciphertext patterns
- Therefore, ECB mode should not be used in practical applications
- Should use CBC, CTR, etc., which are secure encryption modes
Problem 5: Prove Insecurity of Schnorr Signature When Random Number is Restricted
Problem: Prove that if in Schnorr signature the random number is only chosen from set (instead of uniformly randomly from entire ), then the signature scheme is insecure.
Require complete attack construction and success probability analysis.
Complete Solution:
Schnorr Signature Review:
- Private key:
- Public key:
- Signature: Choose , compute , ,
- Signature:
- Verification: Check
(1) Attack Scenario Setup
Assume signer uses restricted random number set: , instead of randomly from entire .
(2) Attacker Construction
Attacker 's Goal: Recover private key or forge signatures
Attack Algorithm:
Step 1: Observe Signatures
- Attacker queries signature oracle, obtains signature for message
- knows , where
Step 2: Exhaustive Search for For each :
- Compute
- Check if
- If equal, found the used
Step 3: Recover Private Key Once is found, attacker can recover private key:
- From signature:
- Where is known
- Therefore:
(3) Success Probability Analysis
Probability of Finding :
- Random number is uniformly chosen from
- Attacker needs to try at most 3 times
- Success probability: (after at most 3 attempts)
Probability of Recovering Private Key:
- Once is found, can deterministically compute
- Success probability:
Overall Success Probability:
Time Complexity:
- Need to compute at most 3 times
- Each computation requires modular exponentiations
- Total time complexity: (polynomial time)
(4) Forge Signatures
Once attacker obtains private key , can:
- Generate valid signatures for arbitrary messages
- Choose arbitrary (even without restriction)
- Compute , ,
- Output signature
(5) Comparison: If is Chosen from Entire
If is uniformly randomly chosen from entire :
- (typically )
- Attacker needs to try average times to find
- Success probability: (negligible)
- Therefore attack is infeasible
(6) Conclusion
- If random number is only chosen from , attacker can recover private key in polynomial time with probability 1
- This violates unforgeability of digital signatures (attacker can forge arbitrary signatures)
- Therefore, Schnorr signature is insecure when random number is restricted
- Must require to be uniformly randomly chosen from entire
Type 4: Calculation Problems
Problem 6: Complete RSA Encryption/Decryption Calculation
Problem: Given RSA parameters:
- ,
- Public exponent
- Plaintext
Please complete the following calculations: (1) Compute modulus and Euler's totient function (2) Verify is coprime with (3) Compute private exponent (4) Compute ciphertext (5) Verify decryption process
Complete Solution:
(1) Compute Modulus and Euler's Totient Function
Modulus:
Euler's Totient Function:
(2) Verify is Coprime with
Need to verify
Using Euclidean Algorithm:
Therefore ✓
(3) Compute Private Exponent
Need to find such that , i.e.,
Using Extended Euclidean Algorithm:
From above calculation:
- →
- →
- →
Back Substitution:
Therefore
So
Verification: ✓
Therefore
(4) Compute Ciphertext
Public Key: Plaintext:
Check Plaintext Range: ✓ (plaintext is in valid range)
Encryption:
Using Modular Exponentiation:
First express exponent 5 in binary:
Compute :
Compute :
-
-
-
Therefore
-
Compute :
- Therefore
Now compute :
Compute :
- Therefore
(5) Verify Decryption Process
Private Key: Ciphertext:
Decryption:
Using Modular Exponentiation:
Express exponent 173 in binary:
Compute :
Compute :
-
-
-
Therefore
-
Compute :
-
-
-
Therefore
-
Compute :
-
-
-
Therefore
-
Compute :
-
-
-
Therefore
-
Compute :
-
-
-
Therefore
-
Compute :
-
-
-
Therefore
-
Compute :
- Therefore
Now compute :
Compute step by step:
Compute :
-
-
-
Therefore intermediate result =
-
Compute :
-
-
-
Therefore intermediate result =
-
Compute :
-
-
-
Therefore intermediate result =
-
Compute :
- Therefore
Verification:
- Original plaintext:
- Decrypted plaintext:
- ✓
Decryption Successful!
Problem 7: Complete Elgamal Encryption/Decryption Calculation
Problem: Given Elgamal encryption parameters:
- ,
- Private key
- Plaintext
- Random number
Please complete: (1) Compute public key (2) Compute ciphertext (3) Verify decryption process
Complete Solution:
(1) Compute Public Key
Private Key: Generator: Modulus:
Public Key:
Compute :
Therefore
Public Key:
(2) Compute Ciphertext
Plaintext: Random Number: Public Key:
Elgamal Encryption Formula:
Compute :
Compute :
Therefore
Compute :
First compute :
Compute :
Therefore
So
Ciphertext:
(3) Verify Decryption Process
Private Key: Ciphertext:
Elgamal Decryption Formula:
Step 1: Compute
Compute :
Therefore
Step 2: Compute
Need to find , i.e., find such that
Using Extended Euclidean Algorithm:
Back substitution:
Therefore
Verify: ✓
Step 3: Compute Plaintext
Compute :
Therefore
Verification:
- Original plaintext:
- Decrypted plaintext:
- They are equal ✓
Decryption Successful!
Problem 8: Complete Schnorr Signature Calculation
Problem: Given Schnorr signature parameters:
- , ( ✓)
- (generator)
- Private key
- Message
- Random number
- Hash function: (simplified)
Please complete: (1) Compute public key (2) Generate signature (3) Verify signature
Complete Solution:
(1) Compute Public Key
Private Key: Generator: Modulus:
Public Key:
Therefore
Public Key:
(2) Generate Signature
Message: Random Number:
Step 1: Compute Commitment
Compute :
Therefore
Step 2: Compute Challenge
Therefore
Step 3: Compute Response
Therefore
Signature:
(3) Verify Signature
Public Key: Message: Signature:
Verification Formula: Check if
Step 1: Recompute Challenge
Step 2: Compute Left Side
Step 3: Compute Right Side
First compute :
Therefore
Step 4: Compare
- Left side:
- Right side:
- ✓
Verification Passed! Signature is Valid!
Part 2: Public Key Cryptography
Type 1: Concept Explanation
Problem 9: Explain Security of Diffie-Hellman Key Agreement
Problem: Please explain in detail the security of Diffie-Hellman key agreement protocol, including: (1) Basic principles of the protocol (2) Which hard problem the security is based on (3) Why attackers cannot obtain the shared key (4) Security assumptions of the protocol
Complete Solution:
(1) Basic Principles of the Protocol
Diffie-Hellman Key Agreement Protocol allows two communicating parties to establish a shared key over an insecure channel.
Protocol Steps:
- Public Parameters: Choose large prime and generator , parameters are public
- Alice:
- Randomly choose private key
- Compute public key
- Send to Bob
- Bob:
- Randomly choose private key
- Compute public key
- Send to Alice
- Shared Key:
- Alice computes:
- Bob computes:
- Both parties obtain the same shared key
(2) Which Hard Problem Security is Based On
The security of Diffie-Hellman key agreement is based on the hardness of the Discrete Logarithm Problem (DLP).
Discrete Logarithm Problem: Given group (e.g., ), generator , and element , computing is computationally infeasible.
In DH Protocol:
- Attacker sees and
- Attacker wants to compute
- This is equivalent to computing Diffie-Hellman problem (CDH)
- Hardness of CDH is based on hardness of DLP
(3) Why Attackers Cannot Obtain Shared Key
Information Observed by Attacker:
- Public parameters:
- Alice's public key:
- Bob's public key:
What Attacker Wants to Compute:
- Shared key:
Attacker's Difficulties:
Method 1: Directly Compute
- Attacker needs to know or
- But and are private keys, only known to Alice and Bob
- Attacker cannot compute from (this is DLP, computationally infeasible)
Method 2: Compute from and
- This is equivalent to solving Computational Diffie-Hellman (CDH) problem
- CDH problem is computationally infeasible (based on DLP hardness)
Method 3: Man-in-the-Middle Attack (MITM)
- Attacker can intercept and , and send own public key
- But this requires attacker to be able to modify communication channel
- In standard DH protocol, assume communication channel is authenticated (or use digital signatures to prevent MITM)
(4) Security Assumptions of the Protocol
Computational Assumptions:
-
Discrete Logarithm Assumption (DL Assumption):
- In group , given and , computing is computationally infeasible
- This is the foundation of protocol security
-
Computational Diffie-Hellman Assumption (CDH Assumption):
- Given , , , computing is computationally infeasible
- Directly guarantees security of shared key
-
Decisional Diffie-Hellman Assumption (DDH Assumption) (stronger assumption):
- Given , , , , deciding whether or is a random element is computationally infeasible
- Used for stronger security guarantees
Protocol Assumptions:
-
Parameter Selection:
- must be a large prime (typically 2048 bits or larger)
- must be a generator (or large-order element)
- Parameters must be correctly generated
-
Randomness:
- Private keys and must be uniformly randomly chosen from
- Cannot use weak random number generators
-
Communication Security:
- Standard DH does not provide authentication, vulnerable to man-in-the-middle attacks
- In practice, need to combine with digital signatures or certificates
Security Summary:
- DH key agreement is secure under DLP/CDH assumptions
- Attackers cannot compute shared key from public information
- But need to prevent man-in-the-middle attacks (use authentication mechanisms)
Type 2: Scheme Design
Problem 10: Design a Secure Electronic Voting Scheme
Problem: Design an electronic voting scheme using homomorphic encryption that satisfies the following requirements:
- Each voter can only vote once
- Votes are confidential (No one knows specific voting content)
- Can correctly count voting results
- Voters can verify their votes are correctly recorded
Please: (1) Choose appropriate cryptographic tools (2) Describe voting process in detail (3) Explain how each requirement is satisfied
Complete Solution:
(1) Choose Appropriate Cryptographic Tools
Based on requirements, we need the following tools:
- Homomorphic Encryption: Allows computation on ciphertexts, used for vote counting
- Zero Knowledge Proof: Used to prove vote validity (vote value is in allowed range)
- Digital Signature: Used to authenticate voter identity
- Commitment Protocol: Used to ensure vote binding
Specific Choices:
- Homomorphic Encryption: Elgamal homomorphic encryption (supports multiplicative homomorphism)
- Zero Knowledge Proof: Schnorr signature or Sigma protocol
- Digital Signature: RSA-FDH or Schnorr
- Commitment Protocol: Pedersen commitment
(2) Detailed Scheme Design
Scheme: Voting Scheme Based on Elgamal Homomorphic Encryption
Setup Phase:
- Choose Elgamal parameters: large prime , generator
- Voting authority generates key pair: private key , public key
- Public parameters:
Voting Phase (Voter ):
- Identity Authentication: Voter uses digital signature to prove identity
- Choose Vote: Voter chooses (support or oppose)
- Encrypt Vote:
- Randomly choose
- Compute:
- Compute: (Note: here represents vote, )
- Ciphertext:
- Zero Knowledge Proof: Voter generates ZK proof proving (using OR proof)
- Submit: Voter submits
Counting Phase:
- Verify All Votes:
- Verify each voter's identity (digital signature)
- Verify each vote's ZK proof (ensure )
- Homomorphic Computation:
- For all valid vote ciphertexts , compute:
- Due to Elgamal's multiplicative homomorphism:
- Decrypt Counting Result:
- Use private key to decrypt
- Compute:
- Compute discrete logarithm: (since is small, can exhaustively search)
- Counting result: Support votes = , Oppose votes =
(3) Explain How Each Requirement is Satisfied
Requirement 1: Each Voter Can Only Vote Once
- Solution: Use digital signature to authenticate identity
- Each voter signs vote with own private key
- Voting authority maintains list of voters who have voted
- If same identity votes again, reject second vote
- Technical Details:
- Voter submits , where
- Voting authority verifies signature and checks if identity has voted
Requirement 2: Votes are Confidential (No One Knows Specific Voting Content)
- Solution: Use Elgamal encryption
- Each vote is encrypted as
- Only voting authority has private key , can decrypt
- But voting authority can only see counting result, cannot see individual votes (if using threshold decryption)
- Technical Details:
- Use random number to ensure same vote produces different ciphertexts
- Encryption is CPA secure
- Can further use threshold encryption, requiring multiple authorities to cooperate for decryption
Requirement 3: Can Correctly Count Voting Results
- Solution: Use homomorphic encryption
- Elgamal supports multiplicative homomorphism: (in exponent)
- Multiply all vote ciphertexts to get encryption of total votes
- After decryption, get , which is support votes
- Technical Details:
- Homomorphism:
- After decryption, get , compute discrete logarithm to get
- For votes, , can exhaustively compute discrete logarithm
Requirement 4: Voters Can Verify Their Votes are Correctly Recorded
- Solution: Use commitment and verification mechanism
- When voter submits vote, also submit commitment
- Voting authority publishes all vote ciphertexts (without correspondence)
- Voters can verify their ciphertext is in the list
- After counting, voters can verify commitment (optional)
- Technical Details:
- Voter computes
- Submits
- Voting authority publishes list of all
- Voter checks own is in list
- After counting, can reveal and to verify commitment
Scheme Summary:
- ✅ Satisfies uniqueness: Digital signature prevents duplicate voting
- ✅ Satisfies confidentiality: Elgamal encryption protects vote content
- ✅ Satisfies correctness: Homomorphic encryption supports correct counting
- ✅ Satisfies verifiability: Commitment mechanism allows verification
Type 3: Proof Problems
Problem 11: Prove Relationship Between Three Security Properties of Hash Functions
Problem: Prove the relationship between three security properties of hash functions: (1) Collision Resistance (2) Second Preimage Resistance (3) Preimage Resistance
Please prove:
- Collision Resistance Second Preimage Resistance
- Second Preimage Resistance Preimage Resistance (in random oracle model)
Complete Solution:
(1) Define Three Security Properties
Preimage Resistance: For all polynomial-time attackers , there exists negligible function such that: That is: Given hash value , finding such that is computationally infeasible.
Second Preimage Resistance: For all polynomial-time attackers , there exists negligible function such that: That is: Given , finding such that is computationally infeasible.
Collision Resistance: For all polynomial-time attackers , there exists negligible function such that: That is: Finding arbitrary such that but is computationally infeasible.
(2) Prove: Collision Resistance Second Preimage Resistance
Proof Method: Proof by contradiction
Assume hash function is collision resistant but not second preimage resistant. We will construct an algorithm to find collision, contradicting collision resistance.
Construct Attacker :
Algorithm :
- Randomly choose
- Call second preimage attacker (assume exists), input
- outputs such that
- Output collision
Success Probability Analysis:
- If can find second preimage with non-negligible probability
- Then can find collision with same probability
- This contradicts assumption that is collision resistant
Conclusion:
- If is collision resistant, then must be second preimage resistant
- Therefore: Collision Resistance Second Preimage Resistance
(3) Prove: Second Preimage Resistance Preimage Resistance (in Random Oracle Model)
Proof Method: In random oracle model, if hash function is second preimage resistant, then it is also preimage resistant.
Proof Idea: In random oracle model, hash function behaves like a random function. If is second preimage resistant, then:
-
Properties of Random Oracle:
- For each input , is uniformly random
- Outputs for different inputs are independent
-
Difficulty of Preimage Attack:
- Given hash value , attacker needs to find such that
- Since is random, attacker can only search by querying
- Each query succeeds with probability approximately ( is output length)
- Need average queries to find preimage
-
Relationship with Second Preimage Resistance:
- If is second preimage resistant, then given , finding such that is difficult
- In random oracle model, this is equivalent to preimage resistance
- Because if can find preimage, then can find second preimage (by first randomly choosing , then finding preimage of )
Formal Proof (simplified): Assume there exists preimage attacker that can find preimage with non-negligible probability. Construct second preimage attacker :
Algorithm :
- Compute
- Call , obtain
- If and , output
- Otherwise output failure
Success Probability:
- If successfully finds preimage, and (high probability, since input space is large)
- Then successfully finds second preimage
- This contradicts second preimage resistance
Conclusion:
- In random oracle model, Second Preimage Resistance Preimage Resistance
- Note: This conclusion depends on random oracle model, may not hold for actual hash functions
(4) Summary
Relationship between three security properties:
- ✅ Collision Resistance Second Preimage Resistance (unconditionally holds)
- ✅ Second Preimage Resistance Preimage Resistance (holds in random oracle model)
- ❌ Preimage Resistance Second Preimage Resistance (does not hold)
- ❌ Second Preimage Resistance Collision Resistance (does not hold)
Practical Significance:
- Collision resistance is the strongest property
- When designing hash functions, usually directly prove collision resistance
- If hash function is collision resistant, automatically satisfies other two properties
Type 4: Calculation Problems
Problem 12: Complete Diffie-Hellman Key Agreement Calculation
Problem: Given Diffie-Hellman parameters:
- , ( is a generator of )
- Alice chooses private key
- Bob chooses private key
Please complete: (1) Compute Alice's and Bob's public keys (2) Compute shared keys calculated by both parties (3) Verify both parties obtain the same key (4) Directly compute to verify result
Complete Solution:
(1) Compute Alice's and Bob's Public Keys
Alice's Public Key:
Compute :
Therefore
Bob's Public Key:
Compute :
- (already computed)
- (already computed)
Compute :
Therefore
(2) Compute Shared Keys Calculated by Both Parties
Shared Key Calculated by Alice:
Compute :
- (since )
Therefore
Shared Key Calculated by Bob:
Compute :
Compute :
Therefore
(3) Verify Both Parties Obtain the Same Key
- Key calculated by Alice:
- Key calculated by Bob:
- ✓
Shared Key:
(4) Directly Compute to Verify Result
Since (by Fermat's little theorem, because is coprime with , and order of divides ), we can simplify:
Therefore , consistent with previous calculation ✓
Verification Complete!
Problem 13: Complete Elliptic Curve Point Operation Calculation
Problem: Given elliptic curve , point .
Please complete: (1) Verify point is on the curve (2) Compute (point doubling) (3) If is also on the curve, compute (point addition)
Complete Solution:
(1) Verify Point is on the Curve
Curve Equation:
Point :
- Left side:
- Right side:
✓, therefore point is on the curve.
(2) Compute (Point Doubling)
Point Doubling Formula ():
- Slope:
Given Parameters:
- (curve parameter)
Compute Slope :
Compute :
- Need
- , so
Therefore
Compute :
Compute :
Therefore
Verification: Check if is on the curve
- Left side:
- Right side:
- ✓
(3) Compute (Point Addition)
First Verify is on the Curve:
- Left side:
- Right side:
- ✓, is on the curve
Point Addition Formula ():
- Slope:
Given Parameters:
Compute Slope :
Compute :
Compute :
Therefore
Verification: Check if is on the curve
- Left side:
- Right side:
- ✓
All Calculations Complete!
Part 3: Digital Signatures
Type 1: Concept Explanation
Problem 14: Explain EU-CMA Security Model of Digital Signatures
Problem: Please explain in detail the EU-CMA (Existential Unforgeability under Chosen Message Attack) security model of digital signatures, including: (1) Definition of EU-CMA game (2) Meaning of existential unforgeability (3) Meaning of adaptive chosen message attack (4) Why this security model is reasonable
Complete Solution:
(1) Definition of EU-CMA Game
EU-CMA Security Game is an interactive game used to define security of digital signatures:
Game Participants:
- Challenger: Runs signature scheme, generates key pair
- Attacker: Attempts to forge signatures
Game Steps:
-
Initialization Phase:
- Challenger generates key pair:
- Challenger sends public key to attacker
- Private key is kept secret
-
Learning Phase:
- Attacker can query signature oracle arbitrarily many polynomial times
- For each query message , attacker obtains signature
- Attacker obtains signature pairs:
- Where is polynomially bounded number of queries
-
Forgery Phase:
- Attacker outputs forgery:
- Requirement: ( is not a queried message)
-
Decision Phase:
- Challenger verifies:
- If verification passes (outputs 1), attacker wins, game outputs 1
- Otherwise attacker fails, game outputs 0
Attacker's Advantage:
(2) Meaning of Existential Unforgeability
Existential Unforgeability:
- Attacker cannot generate valid signatures for any message
- Even if the message may be meaningless, random, or constructed by attacker
- As long as attacker has not queried signature for that message, cannot forge
Difference from Strong Unforgeability:
- Existential Unforgeability: Attacker cannot forge signatures for new messages
- Strong Unforgeability: Even if attacker sees signature for message , cannot generate another valid signature for that message
Practical Significance:
- Existential unforgeability is already strong enough, because attacker cannot forge signatures for any new message
- This guarantees the basic security goal of digital signatures
(3) Meaning of Adaptive Chosen Message Attack
Adaptive Chosen Message Attack (CMA):
- Attacker can adaptively choose messages to query signatures
- Attacker can choose next message to query based on previous query results
- This models real scenarios where attacker can observe signatures and choose attack strategy accordingly
Why "Adaptive":
- Attacker does not need to submit all messages to query at once
- Can dynamically choose next message based on previous query results
- This makes attack more powerful, security model more strict
Comparison with Other Attack Models:
- Known Message Attack: Attacker can only see random message-signature pairs, cannot choose messages
- Chosen Message Attack: Attacker can choose messages, but must submit all messages at once (non-adaptive)
- Adaptive Chosen Message Attack: Attacker can adaptively choose messages (strongest)
(4) Why This Security Model is Reasonable
Reasonableness Analysis:
-
Models Real Attack Scenarios:
- In reality, attacker may be able to obtain signatures for some messages
- Attacker can choose attack strategy based on observed signatures
- EU-CMA model accurately models this scenario
-
Provides Strong Enough Security Guarantee:
- Even if attacker obtains many message signatures, still cannot forge signatures for new messages
- This guarantees core security goal of digital signatures: unforgeability
-
Security in Practical Applications:
- If digital signature scheme is EU-CMA secure, then in practical applications, even if attacker observes many signatures, cannot forge
- This applies to most practical application scenarios
-
Relationship with Other Security Goals:
- EU-CMA security is the basic security requirement for digital signatures
- Stronger security models (such as strong unforgeability) are needed in some special scenarios, but EU-CMA is sufficient
Summary:
- EU-CMA security model is the standard security definition for digital signature schemes
- It accurately models real attack scenarios
- Provides strong enough security guarantee
- Is a reasonable standard for evaluating security of digital signature schemes
Type 2: Scheme Design
Problem 15: Design a Secure File Sharing Scheme
Problem: Design a secure file sharing scheme that satisfies the following requirements:
- File size is 10GB (very large)
- Payment information is confidential (Payment - No one knows)
- File integrity (Integrity)
- Only Bob can check the file content
Please: (1) Choose appropriate cryptographic tools (2) Explain the scheme's working process in detail (3) Explain how the scheme satisfies each requirement
Complete Solution:
(1) Choose Appropriate Cryptographic Tools
Based on requirement analysis:
- Large File (10GB): Need to use efficient symmetric encryption
- Payment Information Confidential: Need to use public key encryption to protect key
- Integrity: Need to use hash function or MAC
- Only Bob Can Access: Need to use Bob's public key encryption
Chosen Tools:
- Symmetric Encryption: AES-256-CTR mode (suitable for large files, supports parallelization)
- Public Key Encryption: RSA-OAEP or Elgamal (for encrypting symmetric key)
- Hash Function: SHA-256 (for integrity verification)
- Digital Signature (optional): For authenticating sender
(2) Detailed Scheme Design
Scheme: Hybrid Encryption + Hash Verification
Step 1: Sender (Alice) Prepares File
-
Generate Symmetric Key:
- Randomly generate symmetric key: (AES-256 key)
- Choose random IV:
-
Encrypt File:
- Split 10GB file into blocks: (each block 128 bits)
- Use AES-CTR mode encryption:
- For each block:
- Ciphertext file:
-
Compute File Hash:
- Compute hash of original file:
- This is used for integrity verification
-
Encrypt Symmetric Key:
- Use Bob's public key encryption:
- Only Bob can decrypt to obtain and
-
(Optional) Sign Hash Value:
- Use Alice's private key to sign:
- Used to authenticate file source
Step 2: Send Alice sends to Bob:
- Encrypted file: (10GB)
- Encrypted key:
- File hash value:
- (Optional) Signature:
Step 3: Receiver (Bob) Verifies and Decrypts
-
Decrypt Key:
- Use Bob's private key to decrypt:
- Only Bob has , only Bob can decrypt
-
Decrypt File:
- Use AES-CTR decryption:
- For each block:
- Recover file:
- Use AES-CTR decryption:
-
Verify Integrity:
- Compute hash of received file:
- Check if
- If equal, file is intact; otherwise file has been tampered with
-
(Optional) Verify Signature:
- Verify
- Confirm file is from Alice
(3) Explain How Each Requirement is Satisfied
Requirement 1: File Size is 10GB (Very Large)
- Solution: Use symmetric encryption (AES-CTR)
- Symmetric encryption is fast, suitable for large files
- CTR mode supports parallel encryption/decryption
- 10GB file can be processed efficiently
- Why Not Use Public Key Encryption Directly for File:
- Public key encryption is slow (100-1000 times slower than symmetric encryption)
- RSA can only encrypt data smaller than modulus (typically 2048 bits)
- Therefore use hybrid encryption: public key encrypts small key (256 bits), symmetric encrypts large file (10GB)
Requirement 2: Payment Information Confidential (Payment - No one knows)
- Solution: Use Bob's public key encryption for symmetric key
- Symmetric key is encrypted using Bob's public key
- Only Bob has private key , only Bob can decrypt to obtain
- Without , cannot decrypt file
- Therefore, except Bob, no one can know file content (including payment information)
- Security Guarantee:
- RSA-OAEP is CPA secure
- Even if attacker intercepts , cannot decrypt (unless can break RSA)
- Even if attacker intercepts encrypted file , without cannot decrypt
Requirement 3: File Integrity (Integrity)
- Solution: Use hash function to verify integrity
- Alice computes hash of original file
- Bob computes hash of received file after decryption
- If , file is intact; otherwise file has been tampered with
- Security Guarantee:
- SHA-256 has collision resistance
- Attacker cannot find different files producing the same hash value
- Therefore can detect any tampering
- If File is Tampered:
- Attacker modifies to get
- Bob decrypts to get
- Computes
- Verification fails, Bob knows file has been tampered with
Requirement 4: Only Bob Can Check File Content
- Solution: Use Bob's public key encryption
- Symmetric key is encrypted using Bob's public key
- Only Bob has private key , only Bob can decrypt to obtain
- Without , cannot decrypt file
- Security Guarantee:
- Public key encryption ensures only private key holder (Bob) can decrypt
- Even if attacker intercepts all transmitted data (, , ), cannot obtain file content
- This provides access control
Scheme Summary:
- ✅ Satisfies large file requirement: Uses efficient symmetric encryption (AES-CTR)
- ✅ Satisfies confidentiality requirement: Uses public key encryption to protect key (RSA-OAEP)
- ✅ Satisfies integrity requirement: Uses hash function for verification (SHA-256)
- ✅ Satisfies access control requirement: Only Bob can decrypt (using Bob's public key)
Security Analysis:
- Confidentiality: Guaranteed by RSA-OAEP and AES-CTR
- Integrity: Guaranteed by SHA-256 hash verification
- Authentication (optional): Guaranteed by digital signature
- Access Control: Guaranteed by public key encryption, only Bob can access
Type 3: Proof Problems
Problem 16: Prove CBC Mode Security under CPA (Simplified Proof)
Problem: Please prove that CBC (Cipher Block Chaining) mode is semantically secure under CPA (Chosen Plaintext Attack).
Requirements: (1) Give proof assumptions (2) Use game hopping technique (3) Analyze differences between each game (4) Draw conclusion
Complete Solution:
(1) Proof Assumptions
Assumptions:
- Underlying block cipher is a pseudo-random permutation (PRP)
- Initialization vector is randomly chosen (different for each encryption)
CBC Mode Review:
- Encryption: , for
- Decryption:
(2) Proof Using Game Hopping Technique
Game Hopping is a proof technique that proves security through a series of games, where each game differs only slightly from the previous one.
Game 0 (Real CBC Mode):
- Challenger generates key
- Attacker queries encryption oracle, obtains
- Attacker chooses , obtains challenge ciphertext
- Attacker outputs
Game 1 (Use Random Permutation Instead of Block Cipher):
- Challenger chooses random permutation (instead of using )
- Encryption uses:
- Other steps same as Game 0
Game 2 (Use True Random Function):
- Challenger chooses true random function (instead of permutation)
- Encryption uses:
- Other steps same as Game 1
Game 3 (Ideal Case):
- Challenger directly outputs random ciphertext (independent of plaintext)
- Attacker cannot obtain any information about
(3) Analyze Differences Between Each Game
Difference from Game 0 to Game 1:
- Use random permutation instead of
- If is PRP, then Game 0 and Game 1 are computationally indistinguishable
- Difference: (negligible)
Difference from Game 1 to Game 2:
- Use random function instead of random permutation
- Since difference between permutation and function is small (birthday paradox), difference is negligible
- Difference: (negligible)
Difference from Game 2 to Game 3:
- In Game 2, if is random, then each block's input looks random
- Random function 's output also looks random
- Therefore, entire ciphertext looks random, independent of plaintext
- Difference: (negligible)
(4) Draw Conclusion
Attacker's Advantage in Game 3:
- In Game 3, ciphertext is completely random, contains no information about
- Attacker's advantage: (cannot distinguish)
Attacker's Advantage in Game 0: (negligible function)
Conclusion:
- If underlying block cipher is PRP, and is random
- Then CBC mode is semantically secure under CPA
- Attacker's advantage is negligible
Important Condition:
- must be random (different for each encryption)
- If is fixed or predictable, CBC mode is insecure
Type 4: Calculation Problems
Problem 17: Complete RSA-FDH Signature Calculation
Problem: Given RSA-FDH parameters:
- ,
- Public exponent
- Message , assume
Please complete: (1) Compute key pair (2) Generate signature (3) Verify signature
Complete Solution:
(1) Compute Key Pair
Modulus:
Euler's Totient Function:
Verify is Coprime with :
- ✓ (because 5 is prime, and 5 does not divide 288)
Compute Private Exponent : Need
Using extended Euclidean algorithm:
Back substitution:
Therefore
Verification: ✓
Key Pair:
- Public key:
- Private key:
(2) Generate Signature
Message Hash:
Check Range: ✓ (in valid range)
Compute Signature:
Using Modular Exponentiation:
Express exponent 173 in binary:
Compute :
Compute :
Compute step by step:
Therefore
(3) Verify Signature
Public Key: Message Hash: Signature:
Verification: Check if , i.e.,
Compute :
Compute :
Therefore ✓
Verification Passed! Signature is Valid!
Part 4: Advanced Topics
Type 1: Concept Explanation
Problem 18: Explain Three Properties of Zero Knowledge Proof
Problem: Please explain in detail the three properties of Zero Knowledge Proof: (1) Completeness (2) Soundness (3) Zero-Knowledge
And explain the practical significance of each property.
Complete Solution:
(1) Completeness
Definition: If the prover indeed knows the secret (or the statement is true), then an honest verifier always accepts the proof.
Formal Definition:
Intuitive Understanding:
- If the prover really knows the secret and honestly executes the protocol
- The verifier should always accept the proof (will not incorrectly reject)
- This guarantees the "usability" of the protocol: honest prover can successfully prove
Practical Significance:
- If completeness is not satisfied, even if prover knows the secret, may be rejected
- This would make the protocol unusable
- Completeness guarantees "true statements can always be proven"
Example: In zero knowledge proof of discrete logarithm:
- If prover knows such that
- And honestly executes the protocol (computes correct response )
- Then verifier always accepts (because )
(2) Soundness
Definition: If the prover does not know the secret (or the statement is false), then the verifier rejects the proof with high probability.
Formal Definition: where is a negligible function.
Intuitive Understanding:
- If the prover does not know the secret but tries to deceive the verifier
- The verifier should reject with high probability (will not incorrectly accept)
- This guarantees the "security" of the protocol: prover without secret cannot pass verification
Practical Significance:
- If soundness is not satisfied, prover without secret may pass verification
- This would make the protocol insecure
- Soundness guarantees "false statements are almost always rejected"
Example: In zero knowledge proof of discrete logarithm:
- If prover does not know , cannot compute correct response
- Verifier's check will fail
- Verifier rejects with high probability
(3) Zero-Knowledge
Definition: The verifier cannot obtain any information about the secret from the proof process (except the fact that the prover knows the secret).
Formal Definition (Simulator Definition): There exists a simulator that can generate proof records indistinguishable from real proofs without knowing the secret.
Intuitive Understanding:
- The verifier can only know the fact that "the prover knows the secret"
- Cannot obtain the secret itself or any other information about the secret
- This guarantees the "privacy" of the protocol
Practical Significance:
- If zero-knowledge is not satisfied, verifier may extract secret information from the proof process
- This would cause privacy leakage
- Zero-knowledge guarantees "except that the statement is true, no other information is leaked"
Example: In zero knowledge proof of discrete logarithm:
- Verifier sees
- But cannot extract information about from these values
- Because is random, is chosen by verifier itself, depends on random number
Relationship Between Three Properties:
- Completeness: Guarantees protocol usability (true statements can be proven)
- Soundness: Guarantees protocol security (false statements are rejected)
- Zero-Knowledge: Guarantees protocol privacy (does not leak secret information)
All Three Are Indispensable:
- Only completeness: Protocol usable but insecure
- Only soundness: Protocol secure but may be unusable
- Only zero-knowledge: Protocol private but may be insecure
- All three satisfied: Protocol is usable, secure, and privacy-preserving
Type 2: Scheme Design
Problem 19: Design Voting Scheme Based on Homomorphic Encryption
Problem: Design an electronic voting scheme using homomorphic encryption that satisfies the following requirements:
- Each voter can only vote once
- Votes are confidential (No one knows specific voting content)
- Can correctly count voting results
- If someone lies (vote value not in allowed range), use zero knowledge proof to prove
Please: (1) Choose appropriate cryptographic tools (2) Describe voting process in detail (3) Explain how to detect and prove vote value is not in range
Complete Solution:
(1) Choose Appropriate Cryptographic Tools
Based on requirements, we need the following tools:
- Homomorphic Encryption: Elgamal encryption (supports multiplicative homomorphism, can be used for counting)
- Zero Knowledge Proof: Sigma protocol (for proving vote value is in allowed range)
- Digital Signature: For authenticating voter identity
- Hash Function: For computing challenge
Specific Choices:
- Homomorphic Encryption: Elgamal encryption (, where )
- Zero Knowledge Proof: OR proof (prove )
- Digital Signature: Schnorr signature or RSA-FDH
- Hash Function: SHA-256
(2) Detailed Scheme Design
Scheme: Voting Scheme Based on Elgamal Homomorphic Encryption
Setup Phase:
- Choose Elgamal parameters: large prime , generator
- Voting authority generates key pair: private key , public key
- Public parameters:
Voting Phase (Voter ):
-
Identity Authentication:
- Voter uses digital signature to prove identity
- Voting authority verifies signature and checks if already voted
-
Choose Vote:
- Voter chooses (0 = oppose, 1 = support)
-
Encrypt Vote:
- Randomly choose
- Compute:
- Compute:
- Ciphertext:
-
Zero Knowledge Proof:
- Generate ZK proof proving
- Use OR proof: prove knowledge of or , where are random numbers for and
-
Submit:
- Voter submits
Counting Phase:
-
Verify All Votes:
- Verify each voter's identity (digital signature)
- Verify each vote's ZK proof (ensure )
-
Homomorphic Computation:
- For all valid vote ciphertexts , compute:
- Due to Elgamal's multiplicative homomorphism:
-
Decrypt Counting Result:
- Use private key to decrypt
- Compute:
- Compute discrete logarithm: (since , can exhaustively search)
- Counting result: Support votes = , Oppose votes =
(3) Explain How to Detect and Prove Vote Value is Not in Range
Problem: If someone lies, vote value , how to detect?
Solution: Use Zero Knowledge Proof
OR Proof Construction:
Voter needs to prove: , i.e., prove one of the following two statements is true:
- Statement 1: , i.e.,
- Statement 2: , i.e.,
OR Proof Steps:
-
For case (if voter really chooses ):
- True relation: (because )
- Prover knows , can generate true proof
- For relation, generate simulated proof
-
For case (if voter really chooses ):
- True relation: , i.e.,
- Prover knows , can generate true proof
- For relation, generate simulated proof
-
Verification:
- Verifier checks if OR proof is valid
- If , voter cannot generate valid OR proof
- Verifier rejects the vote
Specific Implementation (simplified):
Voter Generates Proof:
- If :
- True proof: Prove knowledge of such that (i.e., )
- Simulated proof: Generate simulated proof for case
- If :
- True proof: Prove knowledge of such that (i.e., )
- Simulated proof: Generate simulated proof for case
Verifier Verifies:
- Verify validity of OR proof
- If proof is invalid, reject vote
If Someone Lies ():
- Voter cannot generate true proof for or
- Can only generate two simulated proofs
- But simulated proofs cannot pass verification (because challenge distribution is incorrect)
- Verifier detects proof is invalid, rejects vote
Scheme Summary:
- ✅ Satisfies uniqueness: Digital signature prevents duplicate voting
- ✅ Satisfies confidentiality: Elgamal encryption protects vote content
- ✅ Satisfies correctness: Homomorphic encryption supports correct counting
- ✅ Satisfies verifiability: Zero knowledge proof ensures vote value is in allowed range
Type 3: Proof Problems
Problem 20: Prove AND Proof Satisfies Soundness Property
Problem: Prove that AND proof in zero knowledge proof satisfies Soundness property.
Given: Prover wants to prove knowledge of and such that and .
Please prove: If prover does not know or , then verifier rejects proof with high probability.
Complete Solution:
AND Proof Protocol Review:
Protocol Steps:
- Commitment: Prover sends , where , ,
- Challenge: Verifier sends
- Response: Prover sends , where ,
- Verification: Verifier checks and
(1) Proof Idea
Use proof by contradiction: Assume there exists attacker that can pass verification with non-negligible probability even without knowing or . We will prove this contradicts hardness of discrete logarithm problem.
(2) Case Analysis
Case 1: Prover Does Not Know
Assume prover does not know but knows .
Attacker Strategy:
- Attacker can correctly compute (because knows )
- But cannot correctly compute (because does not know )
Verification Failure Analysis:
- Verifier checks:
- If attacker does not know , cannot compute correct
- Assume attacker guesses , then:
- Verification failure probability: , where is negligible
Case 2: Prover Does Not Know
Similarly, if prover does not know , cannot correctly compute , verification fails.
Case 3: Prover Does Not Know and
If prover knows neither nor , cannot correctly compute and , verification must fail.
(3) Formal Proof
Assumption: There exists attacker that can pass verification with non-negligible probability even without knowing or .
Construct Algorithm to Solve Discrete Logarithm Problem:
Given discrete logarithm problem instance: , want to compute .
Algorithm :
- Set and ( knows )
- Run AND proof protocol as verifier
- If attacker passes verification, extract information from response
Key Observation:
- If can pass verification, then
- I.e.,
- Therefore
- If knows and , can compute:
Problem: does not know (because is sent by attacker)
Use Replay Technique:
- runs protocol, obtains , sends challenge , obtains
- replays protocol, uses same , but sends different challenge
- If passes verification again, obtains
- From two responses:
- Therefore:
- If , then:
Success Probability:
- If can pass verification with probability
- Then can solve discrete logarithm problem with probability approximately
- If is non-negligible, then is also non-negligible
- This contradicts hardness of discrete logarithm problem
(4) Conclusion
- If prover does not know or , cannot generate valid AND proof
- Verifier rejects proof with high probability
- Therefore, AND proof satisfies Soundness property
Soundness Error Probability:
- If prover does not know secret, probability of passing verification (negligible function)
- This guarantees security of protocol
Type 4: Calculation Problems
Problem 21: Elgamal Homomorphic Encryption Voting Calculation
Problem: In voting scheme based on Elgamal homomorphic encryption, given:
- Parameters: , , public key
- Three voters' votes:
- Voter 1: (support), random number
- Voter 2: (oppose), random number
- Voter 3: (support), random number
Please complete: (1) Compute ciphertext for each vote (2) Use homomorphic property to compute total vote ciphertext (3) If private key , decrypt to get total vote count
Complete Solution:
(1) Compute Ciphertext for Each Vote
Elgamal Encryption Formula:
- Ciphertext:
Voter 1: ,
Compute :
Therefore
Vote 1 Ciphertext:
Voter 2: ,
- (from previous calculation)
Compute :
Therefore
Vote 2 Ciphertext:
Voter 3: ,
Compute :
-
(already computed)
-
-
Compute :
- (already computed)
Therefore
Vote 3 Ciphertext:
(2) Use Homomorphic Property to Compute Total Vote Ciphertext
Elgamal Homomorphic Property:
Compute Total Ciphertext:
Compute :
Compute :
Therefore
Compute :
Compute :
Therefore
Total Vote Ciphertext:
(3) Decrypt to Get Total Vote Count
Private Key:
Elgamal Decryption Formula:
Step 1: Compute
Compute :
Step 2: Compute
Use extended Euclidean algorithm to find :
Back substitution:
Therefore
Verification: ✓
Step 3: Compute
Therefore
Step 4: Compute Discrete Logarithm
Since (only 3 votes), can exhaustively search:
- ✓
Therefore
Verification:
- Voter 1:
- Voter 2:
- Voter 3:
- ✓
Counting Result:
- Support votes:
- Oppose votes:
Calculation Complete!
Problem 22: Complete Zero Knowledge Proof AND Proof Calculation
Problem: In zero knowledge proof AND proof, given:
- Group , generators ,
- (assume , i.e., , so )
- (assume , i.e., , so )
- Prover knows and
- Prover chooses: ,
- Verifier chooses challenge:
Please complete: (1) Compute commitment (2) Compute response (3) Verify proof
Complete Solution:
(1) Compute Commitment
Prover Knows: , Prover Chooses: ,
Compute Commitment:
Compute :
Therefore
Commitment:
(2) Compute Response
Verifier Challenge:
Compute Response:
(Note: Here is the order of the group, known from previous calculations)
Response:
(3) Verify Proof
Verification Formula:
- Check
- Check
Verify First Relation:
- Left side:
- Right side:
Compute :
Therefore right side:
- Left side:
- Right side:
- ✓
Verify Second Relation:
- Left side:
Compute :
-
-
Right side:
Compute :
Therefore right side:
- Left side:
- Right side:
- ✓
Both Verifications Pass! AND Proof is Valid!
Document continues with more key exam problems...