密码学assign1题目en

16 阅读3分钟

Task A: Secure Movie Transfer Protocol Design

Problem Analysis

Problem Background and Core Challenges

This problem requires Alice to securely and efficiently transfer a 10GB large file to Bob, given that they share a symmetric key KK. The problem involves three interrelated but distinct security requirements that need to be satisfied simultaneously through a comprehensive cryptographic protocol.

Requirement 1: Confidentiality - In-Depth Analysis

Requirement Description: No one except Alice can know what movie Bob will receive.

Security Threat Model:

  • Passive Attack: Attackers can intercept all data during transmission but cannot modify it
  • Active Attack: Attackers can intercept and potentially modify transmitted data
  • Attack Goal: Obtain movie content or movie identity information

Technical Challenges:

  1. Large File Encryption Efficiency: A 10GB file requires an efficient encryption algorithm; computationally expensive schemes are not feasible
  2. Key Management: The problem provides a shared key KK, so no key exchange is needed, but key confidentiality must be ensured
  3. Encryption Mode Selection: Need to choose an encryption mode suitable for large files (e.g., CTR, CBC, etc.)

Solution Key Points:

  • Use symmetric encryption algorithms (e.g., AES) because symmetric encryption is fast and suitable for large files
  • Encryption mode should support parallel processing (e.g., CTR mode) to improve efficiency
  • Must ensure confidentiality of key KK; only Alice and Bob know it
  • Encrypted ciphertext should be indistinguishable to attackers without the key (semantic security)

Why Hash Alone is Insufficient: Hash functions are one-way and cannot recover original content, but the problem requires Bob to decrypt and watch the movie, so a reversible encryption algorithm must be used.

Requirement 2: Efficient Preview - In-Depth Analysis

Requirement Description: Bob doesn't want to decrypt before knowing what movie it is, because decryption takes time.

Real-World Scenario Analysis:

  • Time Cost of Decrypting 10GB File: On modern hardware, decrypting a 10GB file may take several minutes to over ten minutes
  • User Experience Issue: If Bob doesn't know what movie it is and blindly decrypts only to find it's not the desired movie, it wastes significant time and computational resources
  • Efficiency Requirement: Bob needs a method to identify the movie without decrypting the large file

Technical Challenges:

  1. How to Identify Movie Without Decrypting Large File:
    • Option A: Use hash value for identification (but hash values themselves may leak information if attackers know hash values of certain movies)
    • Option B: Use encrypted metadata (more secure, as metadata is also encrypted)
  2. Metadata Size: Metadata must be small enough that decryption time is negligible (typically a few KB, decryption takes only milliseconds)
  3. Metadata Confidentiality: Metadata must also be encrypted; otherwise attackers can learn movie information from metadata

Solution Key Points:

  • Separate movie metadata (e.g., filename, size, duration, type, etc.) from the movie body
  • Encrypt metadata independently to form small ciphertext CIDC_{ID}
  • Bob only needs to decrypt small CIDC_{ID} (a few KB) to obtain movie information
  • Time Comparison: Decrypting metadata (milliseconds) vs. decrypting 10GB file (minutes), efficiency improvement of thousands of times

Why Independent Metadata Encryption is Needed:

  • If metadata and movie body are encrypted together, Bob must decrypt the entire file to see metadata
  • Independent encryption allows Bob to selectively decrypt: first decrypt metadata to judge, then decide whether to decrypt the large file

Requirement 3: Integrity - In-Depth Analysis

Requirement Description: No one can compromise confidentiality or integrity.

Security Threat Model:

  • Tampering Attack: Attackers may modify data during transmission
  • Substitution Attack: Attackers may replace the original file with another file
  • Replay Attack: Attackers may replay old encrypted files (though this problem may not involve this, integrity protection should consider it)

Integrity vs. Confidentiality:

  • Confidentiality: Ensures only authorized users can read content (solved by encryption)
  • Integrity: Ensures data has not been modified (solved by MAC or digital signature)
  • Important Understanding: Encryption only guarantees confidentiality, not integrity! Even if attackers cannot decrypt, they may modify ciphertext, causing Bob to decrypt incorrect content

Why Encryption Cannot Guarantee Integrity:

  • In stream ciphers or certain block cipher modes, attackers can modify certain bits of ciphertext, causing corresponding positions in decrypted plaintext to be modified
  • Even if attackers don't know plaintext content, they may damage data by modifying ciphertext

Technical Challenges:

  1. Choosing Integrity Protection Mechanism:
    • Option A: Use Message Authentication Code (MAC), such as HMAC
    • Option B: Use authenticated encryption mode (e.g., AES-GCM), providing both encryption and authentication
  2. MAC Calculation Target: Should calculate MAC on ciphertext (Encrypt-then-MAC), not on plaintext
  3. MAC Verification Timing: Bob should verify MAC before decryption, allowing early detection of tampering and saving decryption time

Solution Key Points:

  • Use Message Authentication Code (MAC) to protect integrity
  • Adopt "Encrypt-then-MAC" scheme:
    1. First encrypt to obtain ciphertext CIDC_{ID} and CMC_M
    2. Then calculate MAC on ciphertext: Tag=MAC(K,CIDCM)Tag = MAC(K, C_{ID} || C_M)
  • Bob verifies MAC before decryption; if verification fails, discard immediately without decryption
  • This simultaneously protects confidentiality and integrity

Why Use Encrypt-then-MAC:

  • This is the most secure combination method, proven in cryptographic theory
  • Can simultaneously guarantee confidentiality and integrity
  • Verification before decryption allows early detection of tampering

Interrelationships Among the Three Requirements

  1. Balance Between Confidentiality and Preview: Must ensure confidentiality (metadata must also be encrypted) while allowing efficient preview (metadata independently encrypted, can be quickly decrypted)
  2. Balance Between Integrity and Efficiency: Must ensure integrity (using MAC) while ensuring efficiency (MAC verification before decryption allows early detection of tampering)
  3. Overall Security: All three requirements must be satisfied simultaneously; failure of any requirement leads to overall scheme insecurity

Related Cryptographic Knowledge Points

According to cryptographic theory, this problem involves the following core concepts:

  1. Symmetric Encryption:

    • AES (Advanced Encryption Standard) is the most commonly used symmetric encryption algorithm
    • Encryption modes: CBC, CTR, GCM, etc.
    • CPA Security (Chosen Plaintext Attack Security): Under CPA attacks, ciphertext should be semantically secure
  2. Message Authentication Code (MAC):

    • HMAC (Hash-based MAC) is a commonly used MAC construction method
    • MAC provides integrity protection and authentication
    • Both MAC calculation and verification require keys
  3. Authenticated Encryption:

    • Simultaneously provides confidentiality and integrity
    • Encrypt-then-MAC is a standard secure combination method
    • AES-GCM is an authenticated encryption mode providing both encryption and authentication
  4. Large File Processing:

    • Stream ciphers or streaming encryption modes are suitable for large files
    • CTR mode supports parallel processing, suitable for large file encryption
    • Block processing can support streaming transmission

Standard Answer

Requirements

(What you need should be all put here)

  1. Shared key KK.
  2. Symmetric encryption algorithm EE (e.g., AES-CBC or AES-CTR).
  3. Message authentication code algorithm MACMAC (e.g., HMAC), or use AES-GCM which includes authentication.
  4. Descriptive metadata IDID of the movie (e.g., movie name, year, etc.).

Alice's Steps

Step 1: Prepare movie file MM and corresponding brief description IDID.

Step 2: Encrypt description using key KK to obtain CID=EK(ID)C_{ID} = E_K(ID).

Step 3: Encrypt 10GB movie file using key KK to obtain large file ciphertext CM=EK(M)C_M = E_K(M).

Step 4: Compute message authentication code on both ciphertexts to obtain Tag=MAC(K,CIDCM)Tag = MAC(K, C_{ID} || C_M).

Step 5: Send (CID,CM,Tag)(C_{ID}, C_M, Tag) to Bob.

Bob's Steps

Step 1: Upon receiving (CID,CM,Tag)(C_{ID}, C_M, Tag), first verify TagTag using key KK. If verification fails, data has been tampered with, discard immediately (satisfies requirement 3).

Step 2: After verification passes, decrypt the smaller CIDC_{ID} to obtain movie description IDID (satisfies requirement 2, Bob can know the movie content without decrypting the 10GB file).

Step 3: Based on the decrypted IDID, determine if the movie is needed. If needed, decrypt CMC_M to obtain movie content MM (satisfies requirement 1).

Additional Notes (Regarding Requirements)

Satisfies requirement 1: Since symmetric encryption EKE_K is used, third parties without key KK cannot learn the content of IDID and MM.

Satisfies requirement 2: By independently encrypting IDID (metadata), Bob only needs minimal computational overhead to learn the movie information.

Satisfies requirement 3: MACMAC ensures integrity, and the encryption algorithm itself ensures confidentiality.

Task B: Pseudo-Random Generator and Semantic Security

Problem Analysis

Problem Background and Core Challenges

Task B contains two independent cryptographic problems, involving the security of pseudo-random generators (PRG) and the judgment of semantically secure encryption schemes. Both problems are core concepts in cryptographic theory, requiring deep understanding of PRG advantage definition, the role of statistical tests, and the basic requirements of semantic security.


Problem 1: PRG Advantage Calculation

Problem Description

Let G:K{0,1}nG: K \rightarrow \{0,1\}^n be a secure PRG. Define G(k1,k2)=G(k1)G(k2)G'(k_1, k_2) = G(k_1) \land G(k_2), where \land is the bit-wise AND function.

Consider the following statistical test AA on {0,1}n\{0,1\}^n: A(x)A(x) outputs LSB(x)LSB(x), the least significant bit of xx.

Calculate AdvPRG[A,G]Adv_{PRG}[A, G']. You may assume that LSB(G(k))LSB(G(k)) is 0 for exactly half the seeds kKk \in K.

In-Depth Analysis

Definition of PRG Advantage

PRG Advantage is a measure of how well a statistical test can distinguish PRG output from truly random strings.

Formal definition: AdvPRG[A,G]=Pr[A(G(k1,k2))=1]Pr[A(r)=1]Adv_{PRG}[A, G'] = |\Pr[A(G'(k_1, k_2)) = 1] - \Pr[A(r) = 1]|

where:

  • AA is a statistical test (distinguisher)
  • GG' is the PRG under test
  • k1,k2Kk_1, k_2 \leftarrow K are randomly chosen seeds
  • r{0,1}nr \leftarrow \{0,1\}^n is a truly random string

Key Understanding:

  • If AdvPRG[A,G]Adv_{PRG}[A, G'] is large (non-negligible), it means test AA can effectively distinguish GG''s output from random strings, so GG' is not a secure PRG
  • If AdvPRG[A,G]Adv_{PRG}[A, G'] is small (negligible), it means test AA cannot distinguish, but this does not mean GG' is secure (because other tests might exist)
Properties of Bit-wise AND Operation

Key properties of Bit-wise AND:

  • For any two bits a,b{0,1}a, b \in \{0,1\}: ab=1a \land b = 1 if and only if a=1a = 1 and b=1b = 1
  • Therefore: Pr[ab=0]=34\Pr[a \land b = 0] = \frac{3}{4} (three cases: (0,0),(0,1),(1,0)(0,0), (0,1), (1,0))
  • Pr[ab=1]=14\Pr[a \land b = 1] = \frac{1}{4} (only case (1,1)(1,1))

Important observation: Bit-wise AND operation significantly reduces the proportion of 1s in the output.

Distribution of Least Significant Bit (LSB)

Least Significant Bit (LSB) is the rightmost bit of a binary string.

For truly random strings r{0,1}nr \leftarrow \{0,1\}^n:

  • Pr[LSB(r)=0]=12\Pr[LSB(r) = 0] = \frac{1}{2}
  • Pr[LSB(r)=1]=12\Pr[LSB(r) = 1] = \frac{1}{2}

This is because each bit is independently and uniformly random.

Importance of Problem Assumption

The problem assumes: LSB(G(k))LSB(G(k)) is 0 for exactly half the seeds kKk \in K.

This means:

  • PrkK[LSB(G(k))=0]=12\Pr_{k \leftarrow K}[LSB(G(k)) = 0] = \frac{1}{2}
  • PrkK[LSB(G(k))=1]=12\Pr_{k \leftarrow K}[LSB(G(k)) = 1] = \frac{1}{2}

This assumption is reasonable because GG is a secure PRG, and its output should appear random.

Calculating LSB Distribution of GG' Output

Let x1=G(k1)x_1 = G(k_1), x2=G(k2)x_2 = G(k_2), then G(k1,k2)=x1x2G'(k_1, k_2) = x_1 \land x_2.

We need to calculate the distribution of LSB(x1x2)LSB(x_1 \land x_2).

Key steps:

  1. LSB(x1x2)=LSB(x1)LSB(x2)LSB(x_1 \land x_2) = LSB(x_1) \land LSB(x_2) (because bit-wise AND is performed bit by bit)

  2. According to the assumption:

    • Pr[LSB(x1)=0]=12\Pr[LSB(x_1) = 0] = \frac{1}{2}
    • Pr[LSB(x1)=1]=12\Pr[LSB(x_1) = 1] = \frac{1}{2}
    • Pr[LSB(x2)=0]=12\Pr[LSB(x_2) = 0] = \frac{1}{2}
    • Pr[LSB(x2)=1]=12\Pr[LSB(x_2) = 1] = \frac{1}{2}
  3. Since k1k_1 and k2k_2 are independently chosen, LSB(x1)LSB(x_1) and LSB(x2)LSB(x_2) are independent.

  4. Calculate Pr[LSB(x1x2)=1]\Pr[LSB(x_1 \land x_2) = 1]: Pr[LSB(x1x2)=1]=Pr[LSB(x1)=1LSB(x2)=1]\Pr[LSB(x_1 \land x_2) = 1] = \Pr[LSB(x_1) = 1 \land LSB(x_2) = 1] =Pr[LSB(x1)=1]×Pr[LSB(x2)=1]=12×12=14= \Pr[LSB(x_1) = 1] \times \Pr[LSB(x_2) = 1] = \frac{1}{2} \times \frac{1}{2} = \frac{1}{4}

  5. Calculate Pr[LSB(x1x2)=0]\Pr[LSB(x_1 \land x_2) = 0]: Pr[LSB(x1x2)=0]=114=34\Pr[LSB(x_1 \land x_2) = 0] = 1 - \frac{1}{4} = \frac{3}{4}

Calculating PRG Advantage

For GG' output:

  • Pr[A(G(k1,k2))=1]=Pr[LSB(G(k1,k2))=1]=14\Pr[A(G'(k_1, k_2)) = 1] = \Pr[LSB(G'(k_1, k_2)) = 1] = \frac{1}{4}

For truly random strings:

  • Pr[A(r)=1]=Pr[LSB(r)=1]=12\Pr[A(r) = 1] = \Pr[LSB(r) = 1] = \frac{1}{2}

PRG Advantage: AdvPRG[A,G]=1412=14Adv_{PRG}[A, G'] = \left|\frac{1}{4} - \frac{1}{2}\right| = \frac{1}{4}

Security Analysis

Conclusion: AdvPRG[A,G]=14Adv_{PRG}[A, G'] = \frac{1}{4}, which is a non-negligible advantage (constant, does not decrease with security parameter).

Implications:

  • Test AA can distinguish GG''s output from random strings with advantage 14\frac{1}{4}
  • This shows that GG' is not a secure PRG
  • Even though GG is a secure PRG, GG' constructed via bit-wise AND is not secure

Why GG' is insecure:

  • Bit-wise AND operation introduces significant statistical bias
  • The LSB distribution of output is significantly different from random strings (14\frac{1}{4} vs 12\frac{1}{2})
  • This bias can be detected by simple statistical tests

Problem 2: Semantic Security Encryption Scheme Judgment

Problem Description

Let (E,D)(E, D) be a one-time semantically secure cipher where the message and ciphertext space is {0,1}n\{0,1\}^n.

Which of the following encryption schemes are semantically secure? Give your explanation for each of the options.

In-Depth Analysis

Basic Requirements of Semantic Security

Core requirements of Semantic Security:

  1. Ciphertext does not leak plaintext information: Even if the attacker knows some information about the plaintext (such as length, format), they cannot obtain additional information from the ciphertext
  2. Indistinguishability: For any two equal-length plaintexts m0,m1m_0, m_1, their encryptions are computationally indistinguishable
  3. CPA Security: Under chosen plaintext attack, the attacker cannot distinguish encryptions of two plaintexts

One-Time Semantic Security:

  • The encryption scheme is semantically secure when the key is used only once
  • This means the key cannot be reused
  • If the key is reused, the scheme may no longer be secure
Judgment Criteria

For each modified encryption scheme EE', we need to judge:

  1. Does it leak key information?: If the ciphertext contains key information, the attacker can directly obtain the key
  2. Does it leak plaintext information?: If the ciphertext contains partial plaintext information, the attacker can obtain some bits of the plaintext
  3. Does it maintain indistinguishability?: Are encryptions of two different plaintexts still indistinguishable?

Option 1: E((k,k),m)=E(k,m)E(k,m)E'((k, k'), m) = E(k, m) || E(k', m)

Scheme Description

Uses composite key (k,k)(k, k'), encrypts message mm with two different keys separately, then concatenates the two ciphertexts.

Security Analysis

✅ Semantically Secure

Reasons:

  1. Double encryption does not leak information:

    • Both E(k,m)E(k, m) and E(k,m)E(k', m) are semantically secure encryptions
    • Concatenating two ciphertexts does not leak additional plaintext information
  2. Indistinguishability is maintained:

    • For two different plaintexts m0,m1m_0, m_1, E(k,m0)E(k, m_0) and E(k,m1)E(k, m_1) are indistinguishable
    • Similarly, E(k,m0)E(k', m_0) and E(k,m1)E(k', m_1) are indistinguishable
    • Therefore, E(k,m0)E(k,m0)E(k, m_0) || E(k', m_0) and E(k,m1)E(k,m1)E(k, m_1) || E(k', m_1) are also indistinguishable
  3. Key independence:

    • The two keys kk and kk' are independent
    • Even if an attacker could distinguish E(k,m0)E(k, m_0) and E(k,m1)E(k, m_1) (theoretically impossible), they still cannot distinguish E(k,m0)E(k', m_0) and E(k,m1)E(k', m_1)

Formal argument:

  • If there exists an attacker AA that can distinguish E((k,k),m0)E'((k, k'), m_0) and E((k,k),m1)E'((k, k'), m_1)
  • Then we can construct an attacker AA' to distinguish E(k,m0)E(k, m_0) and E(k,m1)E(k, m_1), which contradicts the semantic security of (E,D)(E, D)

Conclusion: ✅ Semantically Secure


Option 2: E(k,m)=E(0n,m)E'(k, m) = E(0^n, m)

Scheme Description

Ignores the actual key kk, always encrypts using the all-zero key 0n0^n.

Security Analysis

❌ Not Semantically Secure

Reasons:

  1. Fixed key:

    • All encryptions use the same fixed key 0n0^n
    • This means the key space is compressed to a single key
  2. Deterministic encryption:

    • The same plaintext always produces the same ciphertext
    • Attackers can observe: E(k,m)=E(0n,m)E'(k, m) = E(0^n, m) is the same for all kk
  3. Attack scenario:

    • Attacker can query the encryption oracle to obtain (mi,E(0n,mi))(m_i, E(0^n, m_i)) pairs
    • When the attacker sees challenge ciphertext c=E(0n,mb)c = E(0^n, m_b), they can compare it with previously queried results
    • If c=E(0n,m0)c = E(0^n, m_0), then b=0b = 0; if c=E(0n,m1)c = E(0^n, m_1), then b=1b = 1
  4. Violates semantic security:

    • Semantic security requires that ciphertext does not leak plaintext information
    • But in this scheme, ciphertext is completely determined by plaintext (because the key is fixed)
    • Attackers can distinguish two plaintexts through encryption queries

Formal argument:

  • Attacker AA's strategy:
    1. Query c0=E(0n,m0)c_0 = E(0^n, m_0) and c1=E(0n,m1)c_1 = E(0^n, m_1)
    2. Receive challenge ciphertext c=E(0n,mb)c = E(0^n, m_b)
    3. If c=c0c = c_0, output b=0b' = 0; otherwise output b=1b' = 1
  • Attacker's advantage: Adv(A)=1Adv(A) = 1 (perfect distinction)

Conclusion: ❌ Not Semantically Secure


Option 3: E(k,m)=E(k,m)kE'(k, m) = E(k, m) || k

Scheme Description

Encrypts message mm to get E(k,m)E(k, m), then directly appends the key kk to the ciphertext.

Security Analysis

❌ Not Semantically Secure

Reasons:

  1. Key leakage:

    • Ciphertext directly contains the key kk
    • Attacker can extract the key from the ciphertext
  2. Complete break:

    • Once the attacker obtains key kk, they can decrypt any ciphertext encrypted with that key
    • This completely breaks the security of encryption
  3. Violates semantic security:

    • Semantic security requires that attackers cannot obtain plaintext information from ciphertext
    • But in this scheme, attackers can directly obtain the key, thus can decrypt any ciphertext
    • This is more serious than just obtaining plaintext information
  4. Attack scenario:

    • Attacker receives ciphertext ckc || k
    • Extracts key kk
    • Uses D(k,c)D(k, c) to decrypt and obtain plaintext mm
    • Perfectly distinguishes two plaintexts (actually can directly decrypt)

Formal argument:

  • Attacker AA's strategy:
    1. Receive challenge ciphertext ck=E(k,mb)kc || k = E(k, m_b) || k
    2. Extract key kk
    3. Compute m=D(k,c)m = D(k, c)
    4. If m=m0m = m_0, output b=0b' = 0; otherwise output b=1b' = 1
  • Attacker's advantage: Adv(A)=1Adv(A) = 1 (perfect distinction, actually can directly decrypt)

Conclusion: ❌ Not Semantically Secure


Option 4: E(k,m)=E(k,m)LSB(m)E'(k, m) = E(k, m) || LSB(m)

Scheme Description

Encrypts message mm to get E(k,m)E(k, m), then directly appends the least significant bit LSB(m)LSB(m) of the plaintext to the ciphertext.

Security Analysis

❌ Not Semantically Secure

Reasons:

  1. Plaintext information leakage:

    • Ciphertext directly contains the least significant bit LSB(m)LSB(m) of the plaintext
    • Attacker can directly obtain 1 bit of plaintext information from the ciphertext
  2. Violates semantic security definition:

    • Semantic security requires that ciphertext does not leak any information about plaintext (except public information like length)
    • But in this scheme, ciphertext leaks the least significant bit of plaintext
    • This directly violates the definition of semantic security
  3. Attack scenario:

    • Suppose attacker needs to distinguish m0m_0 and m1m_1
    • If LSB(m0)LSB(m1)LSB(m_0) \neq LSB(m_1), attacker can:
      1. Receive challenge ciphertext cLSB(mb)=E(k,mb)LSB(mb)c || LSB(m_b) = E(k, m_b) || LSB(m_b)
      2. Extract LSB(mb)LSB(m_b)
      3. If LSB(mb)=LSB(m0)LSB(m_b) = LSB(m_0), output b=0b' = 0; otherwise output b=1b' = 1
    • Attacker's advantage: If LSB(m0)LSB(m1)LSB(m_0) \neq LSB(m_1), then Adv(A)=1Adv(A) = 1 (perfect distinction)
  4. Even if LSB(m0)=LSB(m1)LSB(m_0) = LSB(m_1), still insecure:

    • Although in this case attacker cannot distinguish through LSBLSB
    • The scheme still leaks plaintext information, violating the definition of semantic security
    • Semantic security requires indistinguishability for all plaintext pairs, not just some pairs

Formal argument:

  • Attacker AA's strategy:
    1. Receive challenge ciphertext cLSB(mb)=E(k,mb)LSB(mb)c || LSB(m_b) = E(k, m_b) || LSB(m_b)
    2. Extract LSB(mb)LSB(m_b)
    3. If LSB(mb)=LSB(m0)LSB(m_b) = LSB(m_0), output b=0b' = 0; otherwise output b=1b' = 1
  • If LSB(m0)LSB(m1)LSB(m_0) \neq LSB(m_1), attacker's advantage: Adv(A)=1Adv(A) = 1
  • Even if LSB(m0)=LSB(m1)LSB(m_0) = LSB(m_1), the scheme still leaks plaintext information, violating the definition of semantic security

Conclusion: ❌ Not Semantically Secure


Standard Answer

Problem 1: PRG Advantage Calculation

Answer: AdvPRG[A,G]=14Adv_{PRG}[A, G'] = \frac{1}{4}

Detailed calculation process:

  1. For GG' output:

    • Let x1=G(k1)x_1 = G(k_1), x2=G(k2)x_2 = G(k_2)
    • G(k1,k2)=x1x2G'(k_1, k_2) = x_1 \land x_2
    • LSB(G(k1,k2))=LSB(x1)LSB(x2)LSB(G'(k_1, k_2)) = LSB(x_1) \land LSB(x_2)
    • According to assumption: Pr[LSB(x1)=1]=12\Pr[LSB(x_1) = 1] = \frac{1}{2}, Pr[LSB(x2)=1]=12\Pr[LSB(x_2) = 1] = \frac{1}{2}
    • Since k1k_1 and k2k_2 are independent, LSB(x1)LSB(x_1) and LSB(x2)LSB(x_2) are independent
    • Therefore: Pr[LSB(G(k1,k2))=1]=Pr[LSB(x1)=1]×Pr[LSB(x2)=1]=12×12=14\Pr[LSB(G'(k_1, k_2)) = 1] = \Pr[LSB(x_1) = 1] \times \Pr[LSB(x_2) = 1] = \frac{1}{2} \times \frac{1}{2} = \frac{1}{4}
  2. For truly random strings:

    • Pr[LSB(r)=1]=12\Pr[LSB(r) = 1] = \frac{1}{2} (because each bit is independently and uniformly random)
  3. PRG Advantage: AdvPRG[A,G]=Pr[A(G(k1,k2))=1]Pr[A(r)=1]=1412=14Adv_{PRG}[A, G'] = \left|\Pr[A(G'(k_1, k_2)) = 1] - \Pr[A(r) = 1]\right| = \left|\frac{1}{4} - \frac{1}{2}\right| = \frac{1}{4}

Conclusion: GG' is not a secure PRG, because there exists a statistical test with advantage 14\frac{1}{4}.


Problem 2: Semantic Security Encryption Scheme Judgment

Option 1: E((k,k),m)=E(k,m)E(k,m)E'((k, k'), m) = E(k, m) || E(k', m)

Answer: ✅ Semantically Secure

Explanation:

  • Uses two independent keys to encrypt the message separately and concatenate ciphertexts
  • Each encryption E(k,m)E(k, m) and E(k,m)E(k', m) is semantically secure
  • Concatenating two ciphertexts does not leak additional plaintext information
  • For two different plaintexts m0,m1m_0, m_1, E(k,m0)E(k,m0)E(k, m_0) || E(k', m_0) and E(k,m1)E(k,m1)E(k, m_1) || E(k', m_1) are computationally indistinguishable
  • Therefore the scheme maintains semantic security
Option 2: E(k,m)=E(0n,m)E'(k, m) = E(0^n, m)

Answer: ❌ Not Semantically Secure

Explanation:

  • Ignores the actual key, always encrypts using fixed key 0n0^n
  • This results in deterministic encryption: same plaintext always produces same ciphertext
  • Attackers can distinguish two plaintexts through encryption queries
  • Specific attack: Attacker queries c0=E(0n,m0)c_0 = E(0^n, m_0) and c1=E(0n,m1)c_1 = E(0^n, m_1), then compares challenge ciphertext c=E(0n,mb)c = E(0^n, m_b) with c0c_0 and c1c_1, can perfectly distinguish
Option 3: E(k,m)=E(k,m)kE'(k, m) = E(k, m) || k

Answer: ❌ Not Semantically Secure

Explanation:

  • Ciphertext directly contains the key kk
  • Attacker can extract the key from the ciphertext
  • Once the key is obtained, attacker can decrypt any ciphertext encrypted with that key
  • This completely breaks encryption security, attacker can perfectly distinguish (actually can directly decrypt) two plaintexts
Option 4: E(k,m)=E(k,m)LSB(m)E'(k, m) = E(k, m) || LSB(m)

Answer: ❌ Not Semantically Secure

Explanation:

  • Ciphertext directly contains the least significant bit LSB(m)LSB(m) of the plaintext
  • This leaks 1 bit of plaintext information, directly violating the definition of semantic security
  • Semantic security requires that ciphertext does not leak any information about plaintext (except public information like length)
  • If LSB(m0)LSB(m1)LSB(m_0) \neq LSB(m_1), attacker can perfectly distinguish two plaintexts (advantage is 1)

Summary

Key Points of Problem 1

  1. Bit-wise AND introduces statistical bias: Even if the underlying PRG GG is secure, GG' constructed via bit-wise AND is not secure
  2. PRG advantage calculation: Need to carefully analyze the difference between output distribution and random distribution
  3. Role of statistical tests: Simple statistical tests (such as checking least significant bit) may be sufficient to distinguish PRG output from random strings

Key Points of Problem 2

  1. Core requirement of semantic security: Ciphertext cannot leak any information about plaintext (except public information)
  2. Key leakage: Any form of key leakage will make the scheme insecure
  3. Plaintext information leakage: Even leaking just 1 bit of plaintext information violates semantic security
  4. Problem with deterministic encryption: If the same plaintext always produces the same ciphertext, the scheme is usually insecure

Task C: RSA Trapdoor Function Cracking

Problem Analysis

Problem Background and Core Challenges

Task C requires us to crack the RSA encryption system by factoring large numbers to recover the private key and decrypt the ciphertext. This is a typical RSA trapdoor function reverse problem, with the core being to exploit the fact that RSA security depends on the difficulty of large integer factorization.

Basic Principles of RSA Trapdoor Function

Concept of Trapdoor Function

Trapdoor Function is a one-way function with the following properties:

  1. Forward computation is easy: Given public key (n,e)(n, e) and plaintext mm, computing c=memodnc = m^e \bmod n is easy
  2. Reverse computation is hard: Without the private key, computing plaintext mm from ciphertext cc is hard (equivalent to large integer factorization)
  3. Reverse computation is easy with trapdoor: Given private key (trapdoor information) dd, computing m=cdmodnm = c^d \bmod n is easy
Security Foundation of RSA Algorithm

RSA security depends on:

  • Difficulty of large integer factorization: For large integer n=p×qn = p \times q (where p,qp, q are large primes), factoring nn without knowing pp and qq is computationally difficult
  • If nn can be factored: We can compute ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1), and then compute private key dd

Problem Requirements

Given RSA public key parameters and ciphertext:

  • Modulus NN: 44604329616808079459756585122392040139095129634804109655195170155160216465449
  • Public exponent ee: 65537
  • Ciphertext CC: 23032237286907157904784425728662535477744239553666402922528531869140295938321

Requirement: Provide plaintext MM along with detailed calculation steps.


In-Depth Analysis

Review of RSA Key Generation Process

  1. Choose two large primes: pp and qq
  2. Compute modulus: N=p×qN = p \times q
  3. Compute Euler's totient function: ϕ(N)=(p1)(q1)\phi(N) = (p-1)(q-1)
  4. Choose public exponent: ee such that gcd(e,ϕ(N))=1\gcd(e, \phi(N)) = 1 (usually e=65537e = 65537)
  5. Compute private exponent: dd such that ed1(modϕ(N))ed \equiv 1 \pmod{\phi(N)}, i.e., d=e1modϕ(N)d = e^{-1} \bmod \phi(N)

Key Steps to Crack RSA

Step 1: Factor Modulus NN

Goal: Find two prime factors pp and qq of NN such that N=p×qN = p \times q.

Methods:

  • Trial division: For small primes, try dividing one by one
  • Pollard's rho algorithm: Suitable for medium-sized numbers
  • Number Field Sieve (NFS): Suitable for large numbers (modern standard)
  • Online factorization tools: Such as factordb.com

For this problem: Since NN is a relatively small number (about 155 bits), efficient factorization algorithms can be used. After calculation (can use Python's sympy.factorint or online tools), we obtain:

Factorization method: For such a large number, efficient factorization algorithms are needed, such as:

  • Pollard's rho algorithm
  • Quadratic Sieve
  • Number Field Sieve
  • Online factorization tools (e.g., factordb.com)

Factorization result (obtained through calculation tools): p=[First prime factor obtained through factorization algorithm]p = \text{[First prime factor obtained through factorization algorithm]} q=[Second prime factor obtained through factorization algorithm]q = \text{[Second prime factor obtained through factorization algorithm]}

Verification: p×q=Np \times q = N

Important note: In actual problem solving, calculation tools (such as Python's sympy.factorint or online factorization tools) are needed to factor this large number. Here we provide the steps and method framework for factorization.

Step 2: Compute Euler's Totient Function ϕ(N)\phi(N)

Once pp and qq are obtained, compute: ϕ(N)=(p1)(q1)\phi(N) = (p-1)(q-1)

Step 3: Compute Private Exponent dd

Use extended Euclidean algorithm to compute dd such that: ed1(modϕ(N))ed \equiv 1 \pmod{\phi(N)}

That is: d=e1modϕ(N)d = e^{-1} \bmod \phi(N)

Step 4: Decrypt

Use private key dd to decrypt: M=CdmodNM = C^d \bmod N


Detailed Solution Steps

Step 1: Factor Modulus NN

Given: N=44604329616808079459756585122392040139095129634804109655195170155160216465449N = 44604329616808079459756585122392040139095129634804109655195170155160216465449

Method: Use number theory factorization algorithms (such as Pollard's rho, Quadratic Sieve, etc.) or online factorization tools.

Factorization result (obtained through calculation tools): p=[First prime factor]p = \text{[First prime factor]} q=[Second prime factor]q = \text{[Second prime factor]}

Verification: p×q=Np \times q = N

Actual calculation example:

from sympy import factorint
N = 44604329616808079459756585122392040139095129634804109655195170155160216465449
factors = factorint(N)
p, q = list(factors.keys())

Step 2: Compute ϕ(N)\phi(N)

ϕ(N)=(p1)(q1)\phi(N) = (p-1)(q-1)

Calculation: ϕ(N)=(p1)×(q1)\phi(N) = (p-1) \times (q-1)

Step 3: Verify gcd(e,ϕ(N))=1\gcd(e, \phi(N)) = 1

Verification: gcd(65537,ϕ(N))=1\gcd(65537, \phi(N)) = 1

If gcd(e,ϕ(N))1\gcd(e, \phi(N)) \neq 1, then the private key cannot be computed, and ee needs to be reselected.

Step 4: Compute Private Exponent dd

Use extended Euclidean algorithm to compute dd such that: 65537×d1(modϕ(N))65537 \times d \equiv 1 \pmod{\phi(N)}

Extended Euclidean algorithm steps:

  1. Initialize: r0=ϕ(N)r_0 = \phi(N), r1=er_1 = e, s0=1s_0 = 1, s1=0s_1 = 0
  2. Iterate: For i1i \geq 1:
    • qi=ri1/riq_i = \lfloor r_{i-1} / r_i \rfloor
    • ri+1=ri1qi×rir_{i+1} = r_{i-1} - q_i \times r_i
    • si+1=si1qi×sis_{i+1} = s_{i-1} - q_i \times s_i
  3. Stop when ri=0r_i = 0, then d=si1modϕ(N)d = s_{i-1} \bmod \phi(N)

Python implementation:

def extended_gcd(a, b):
    if a == 0:
        return b, 0, 1
    gcd, x1, y1 = extended_gcd(b % a, a)
    x = y1 - (b // a) * x1
    y = x1
    return gcd, x, y

def mod_inverse(e, phi_N):
    gcd, x, _ = extended_gcd(e, phi_N)
    if gcd != 1:
        raise ValueError("Modular inverse does not exist")
    return (x % phi_N + phi_N) % phi_N

d = mod_inverse(65537, phi_N)

Result: d=[Value computed through extended Euclidean algorithm]d = \text{[Value computed through extended Euclidean algorithm]}

Step 5: Decrypt

Compute: M=CdmodNM = C^d \bmod N

Use fast modular exponentiation algorithm (Python's pow function):

M = pow(C, d, N)

Fast modular exponentiation algorithm principle:

  • Represent dd in binary
  • Use square-and-multiply method, time complexity O(logd)O(\log d)

Final plaintext: M=[Value computed through fast modular exponentiation algorithm]M = \text{[Value computed through fast modular exponentiation algorithm]}

Convert to readable format (if MM is text):

# Convert to bytes
message_bytes = M.to_bytes((M.bit_length() + 7) // 8, 'big')
# Try to decode
message = message_bytes.decode('ascii', errors='ignore')

Actual Calculation Code Example

Python Implementation

# RSA cracking example code

# Given parameters
N = 44604329616808079459756585122392040139095129634804109655195170155160216465449
e = 65537
C = 23032237286907157904784425728662535477744239553666402922528531869140295938321

# Step 1: Factor N (using sympy or online tools)
from sympy import factorint
factors = factorint(N)
p, q = list(factors.keys())
print(f"p = {p}")
print(f"q = {q}")

# Step 2: Compute phi(N)
phi_N = (p - 1) * (q - 1)
print(f"phi(N) = {phi_N}")

# Step 3: Compute private key d (using extended Euclidean algorithm)
def extended_gcd(a, b):
    if a == 0:
        return b, 0, 1
    gcd, x1, y1 = extended_gcd(b % a, a)
    x = y1 - (b // a) * x1
    y = x1
    return gcd, x, y

def mod_inverse(e, phi_N):
    gcd, x, _ = extended_gcd(e, phi_N)
    if gcd != 1:
        raise ValueError("Modular inverse does not exist")
    return (x % phi_N + phi_N) % phi_N

d = mod_inverse(e, phi_N)
print(f"d = {d}")

# Step 4: Decrypt
M = pow(C, d, N)
print(f"Plaintext M = {M}")

# Convert M to readable format (if it's ASCII)
try:
    message = M.to_bytes((M.bit_length() + 7) // 8, 'big')
    print(f"Message (ASCII): {message.decode('ascii', errors='ignore')}")
except:
    print(f"Message (hex): {hex(M)}")

Calculation Notes

  1. Factor NN: This is the most critical step, requiring efficient factorization algorithms
  2. Compute ϕ(N)\phi(N): Once pp and qq are obtained, computation is simple
  3. Compute dd: Use extended Euclidean algorithm, time complexity O(logϕ(N))O(\log \phi(N))
  4. Decrypt: Use fast modular exponentiation algorithm, time complexity O(logd)O(\log d)

Summary

Key Knowledge Points

  1. RSA security depends on large integer factorization: If NN can be factored, RSA can be cracked
  2. Factorization algorithms: Different factorization algorithms are needed for numbers of different sizes
  3. Extended Euclidean algorithm: Used to compute modular inverse
  4. Fast modular exponentiation algorithm: Used to efficiently compute modular exponentiation of large numbers

Notes for Practical Applications

  1. pp and qq must be different: If p=qp = q, then N=p2N = p^2, ϕ(N)=p(p1)\phi(N) = p(p-1), security is greatly reduced
  2. pp and qq must be sufficiently large: Modern standards require at least 1024 bits (about 308 decimal digits)
  3. Difficulty of factorization: For sufficiently large NN (e.g., 2048 bits), factorization is computationally infeasible

Special Characteristics of This Problem

The NN in this problem is relatively small (about 155 bits), and can be factored by modern computers in reasonable time. In practical applications, RSA moduli are usually at least 2048 bits, and factoring such numbers is currently computationally infeasible.

Task D: Oblivious Transfer Protocol

Problem Analysis

Problem Background and Core Challenges

Task D requires designing an Oblivious Transfer Protocol that allows Alice to obtain F(k,m)=H(m)kF(k, m) = H(m)^k from Bob, where Bob has a secret key kZpk \in \mathbb{Z}_p and Alice has an input mMm \in M. The protocol must satisfy two critical privacy requirements:

  1. Bob's Privacy: Bob should not learn mm (except for F(k,m)F(k, m) and gkg^k)
  2. Alice's Privacy: Alice should not learn kk (except for F(k,m)F(k, m) and gkg^k)

This is a typical oblivious transfer scenario where one party (Alice) wants to compute a function that depends on both parties' private inputs, but neither party should reveal their private input.

Basic Concepts of Oblivious Transfer Protocol

Oblivious Transfer (OT) is a cryptographic protocol that allows one party (receiver) to obtain certain information from another party (sender), but the sender does not know what information the receiver obtained.

Special Characteristics of This Problem:

  • This is not a traditional 1-out-of-2 OT (where receiver chooses one of two messages)
  • Rather, it is an oblivious function evaluation: Alice wants to compute F(k,m)=H(m)kF(k, m) = H(m)^k, where HH is a hash function (modeled as a random oracle)

Hash Function and Random Oracle Model

Random Oracle Model:

  • Hash function HH is modeled as a random function
  • For any input xx, H(x)H(x) is a uniformly random value
  • This model simplifies security proofs, but in practice hash functions are deterministic

Properties of H(m)H(m):

  • H(m)H(m) is an element in group GG
  • Since HH is a random oracle, H(m)H(m) appears random and does not leak information about mm

Key Ideas in Protocol Design

Alice's First Step: Blinding the Input

First step given in the hint:

  • Alice chooses a random number ρZq\rho \leftarrow \mathbb{Z}_q
  • Alice computes and sends to Bob: m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho}

Key Observations:

  1. Blinding: ρ\rho is a random number used to "blind" H(m)H(m), so Bob cannot recover H(m)H(m) from m^\hat{m}
  2. Group Operation: m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho} is multiplication in group GG
  3. Privacy Protection: Since ρ\rho is random, even if Bob knows gg and m^\hat{m}, he cannot determine the value of H(m)H(m) (unless he can solve the discrete logarithm problem)
Bob's Response: Computing the Function Value

What Bob needs to do:

  • Bob receives m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho}
  • Bob wants to compute F(k,m)=H(m)kF(k, m) = H(m)^k, but does not know H(m)H(m)
  • Bob can compute: m^k=(H(m)gρ)k=H(m)k(gρ)k=H(m)kgkρ\hat{m}^k = (H(m) \cdot g^{\rho})^k = H(m)^k \cdot (g^{\rho})^k = H(m)^k \cdot g^{k\rho}

Problem: What Bob computes is H(m)kgkρH(m)^k \cdot g^{k\rho}, not H(m)kH(m)^k.

Solution:

  • Bob needs to send two values to Alice:
    1. (m^)k=H(m)kgkρ(\hat{m})^k = H(m)^k \cdot g^{k\rho}
    2. gkg^k (which Alice is allowed to know)
Alice's Final Step: Unblinding

What Alice needs to do:

  • Alice receives:
    1. (m^)k=H(m)kgkρ(\hat{m})^k = H(m)^k \cdot g^{k\rho}
    2. gkg^k
  • Alice knows her random number ρ\rho
  • Alice can compute: (gk)ρ=gkρ(g^k)^{\rho} = g^{k\rho}
  • Alice computes: H(m)k=(m^)k/(gk)ρ=(H(m)kgkρ)/gkρH(m)^k = (\hat{m})^k / (g^k)^{\rho} = (H(m)^k \cdot g^{k\rho}) / g^{k\rho}

Verification: H(m)k=(m^)k(gk)ρ=H(m)kgkρgkρ=H(m)kH(m)^k = \frac{(\hat{m})^k}{(g^k)^{\rho}} = \frac{H(m)^k \cdot g^{k\rho}}{g^{k\rho}} = H(m)^k \quad \checkmark

Security Analysis

Bob's Privacy (Confidentiality of kk)

What Bob reveals:

  • Bob sends gkg^k to Alice
  • But according to the problem requirements, Alice is allowed to know gkg^k (this is part of the protocol design)

What Bob does not reveal:

  • Bob does not directly send kk to Alice
  • Computing kk from gkg^k requires solving the discrete logarithm problem, which is computationally hard
  • Therefore, Bob's key kk is kept secret (under the discrete logarithm assumption)
Alice's Privacy (Confidentiality of mm)

What Alice reveals:

  • Alice sends m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho} to Bob

Can Bob learn mm?:

  • Bob knows m^\hat{m} and gg, but does not know ρ\rho
  • To recover H(m)H(m) from m^\hat{m}, Bob would need to know ρ\rho, or be able to "separate" H(m)H(m) and gρg^{\rho}
  • Since ρ\rho is randomly chosen and H(m)H(m) is random in the random oracle model, Bob cannot distinguish m^\hat{m} from a random group element
  • Therefore, Bob cannot obtain information about mm (under the random oracle model and discrete logarithm assumption)

Related Cryptographic Knowledge Points

  1. Oblivious Transfer Protocol: Allows one party to obtain information from another, but the sender does not know what the receiver obtained
  2. Blinding Technique: Using random numbers to hide true values
  3. Discrete Logarithm Problem: Computing kk from gkg^k is hard
  4. Random Oracle Model: Modeling hash functions as random functions to simplify security proofs
  5. Group Operations: Using group properties (such as exponent rules) to construct protocols

Standard Answer

Protocol Steps

Step 1: Alice Blinds the Input

Alice's operations:

  1. Alice chooses a random number ρZq\rho \leftarrow \mathbb{Z}_q
  2. Alice computes: m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho}
  3. Alice sends m^\hat{m} to Bob

Purpose:

  • Blind H(m)H(m) so that Bob cannot recover H(m)H(m) or mm from m^\hat{m}
  • ρ\rho is randomly chosen, ensuring m^\hat{m} appears random
Step 2: Bob Computes and Responds

Bob's operations:

  1. Bob receives m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho}
  2. Bob computes:
    • (m^)k=(H(m)gρ)k=H(m)kgkρ(\hat{m})^k = (H(m) \cdot g^{\rho})^k = H(m)^k \cdot g^{k\rho}
    • gkg^k (which Alice is allowed to know)
  3. Bob sends ((m^)k,gk)((\hat{m})^k, g^k) to Alice

Key observation:

  • Bob computes (m^)k(\hat{m})^k, which contains H(m)kH(m)^k but is "contaminated" by gkρg^{k\rho}
  • Bob also sends gkg^k, which is needed by Alice for unblinding
Step 3: Alice Unblinds to Obtain Result

Alice's operations:

  1. Alice receives ((m^)k,gk)((\hat{m})^k, g^k)
  2. Alice knows her random number ρ\rho
  3. Alice computes:
    • (gk)ρ=gkρ(g^k)^{\rho} = g^{k\rho}
    • H(m)k=(m^)k(gk)ρ=H(m)kgkρgkρ=H(m)kH(m)^k = \frac{(\hat{m})^k}{(g^k)^{\rho}} = \frac{H(m)^k \cdot g^{k\rho}}{g^{k\rho}} = H(m)^k
  4. Alice obtains F(k,m)=H(m)kF(k, m) = H(m)^k

Verification calculation: (m^)k(gk)ρ=(H(m)gρ)k(gk)ρ=H(m)kgkρgkρ=H(m)k\frac{(\hat{m})^k}{(g^k)^{\rho}} = \frac{(H(m) \cdot g^{\rho})^k}{(g^k)^{\rho}} = \frac{H(m)^k \cdot g^{k\rho}}{g^{k\rho}} = H(m)^k \quad \checkmark

Security Explanation

Bob's Privacy (Confidentiality of kk)
  • Bob only sends gkg^k, not kk itself
  • Computing kk from gkg^k requires solving the discrete logarithm problem, which is computationally hard (under the discrete logarithm assumption)
  • Therefore, kk is kept secret from Alice (except for gkg^k and F(k,m)F(k, m))
Alice's Privacy (Confidentiality of mm)
  • Alice only sends m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho}, where ρ\rho is randomly chosen
  • Since ρ\rho is random and H(m)H(m) is random in the random oracle model, m^\hat{m} appears as a random group element
  • Bob cannot recover H(m)H(m) or mm from m^\hat{m} (under the random oracle model and discrete logarithm assumption)
  • Therefore, mm is kept secret from Bob

Protocol Summary

Complete Protocol Flow:

  1. Alice → Bob: m^=H(m)gρ\hat{m} = H(m) \cdot g^{\rho} (where ρZq\rho \leftarrow \mathbb{Z}_q is randomly chosen)

  2. Bob → Alice: ((m^)k,gk)((\hat{m})^k, g^k)

    • where (m^)k=H(m)kgkρ(\hat{m})^k = H(m)^k \cdot g^{k\rho}
  3. Alice computes: H(m)k=(m^)k(gk)ρH(m)^k = \frac{(\hat{m})^k}{(g^k)^{\rho}}

Result:

  • Alice successfully obtains F(k,m)=H(m)kF(k, m) = H(m)^k
  • Bob does not know mm
  • Alice does not know kk (except for gkg^k and H(m)kH(m)^k)

Additional Notes

Why This Protocol is Oblivious Transfer

Definition of Oblivious Transfer:

  • Receiver (Alice) obtains certain information from sender (Bob)
  • Sender (Bob) does not know what information receiver (Alice) obtained

In This Protocol:

  • Alice obtains F(k,m)=H(m)kF(k, m) = H(m)^k
  • Bob does not know mm, so he does not know which function value Alice computed
  • This satisfies the definition of oblivious transfer

Protocol Extensibility

Can be extended to multiple inputs:

  • If Alice has multiple inputs m1,m2,,mnm_1, m_2, \ldots, m_n, the protocol can be executed for each input
  • Each execution uses a different random number ρi\rho_i

Can be extended to multiple keys:

  • If Bob has multiple keys k1,k2,,knk_1, k_2, \ldots, k_n, the protocol can be executed for each key
  • But each execution requires Bob to know the corresponding key

Practical Applications

Application Scenarios:

  • Privacy-preserving data queries: Alice wants to query a database without revealing the query content
  • Privacy-preserving computation: Two parties want to compute a function without revealing their respective inputs
  • Electronic voting: Voters want to vote without revealing their vote content

Limitations:

  • Requires both parties to be online (cannot be offline)
  • Requires trusted random number generation
  • Security depends on discrete logarithm assumption and random oracle model

Task E: ElGamal Homomorphism Analysis

Problem Analysis

Problem Background and Core Challenges

Task E delves into the homomorphic properties of EMEG, a variant of the ElGamal encryption system. ElGamal is a public-key encryption scheme based on the discrete logarithm problem, and its standard form inherently possesses multiplicative homomorphism. This problem requires us to first prove and demonstrate this multiplicative homomorphism, and then explore whether it can be adapted to be additively homomorphic, analyzing the advantages and disadvantages of such a modification.

Definition of ElGamal Encryption System EMEG

Group GG: A cyclic group of prime order qq, generated by generator gg.

Key Generation: Same as standard ElGamal.

  • Choose private key αZq\alpha \in \mathbb{Z}_q
  • Compute public key u=gαGu = g^{\alpha} \in G
  • Public key is (g,u)(g, u), private key is α\alpha

Encryption (E)(E):

  • Input: Public key pk=uGpk = u \in G, message mGm \in G
  • Steps:
    1. Randomly choose βZq\beta \in \mathbb{Z}_q
    2. Compute v=gβv = g^{\beta}
    3. Compute e=uβme = u^{\beta} \cdot m
  • Output: Ciphertext (v,e)(v, e)

Decryption (D)(D):

  • Input: Private key sk=αZqsk = \alpha \in \mathbb{Z}_q, ciphertext (v,e)G2(v, e) \in G^2
  • Steps:
    1. Compute s=vαs = v^{\alpha} (shared secret)
    2. Compute plaintext m=e/s=e/vαm = e / s = e / v^{\alpha}
  • Output: Plaintext mm

Requirement 1: In-Depth Analysis of Multiplicative Homomorphism

Requirement Description: Prove that EMEG possesses multiplicative homomorphism, meaning that given two ciphertexts c1=E(pk,m1)c_1 = E(pk, m_1) and c2=E(pk,m2)c_2 = E(pk, m_2), a new ciphertext cc can be constructed such that its decryption yields m1m2m_1 \cdot m_2.

Technical Challenges:

  1. Understanding Homomorphism Definition: Multiplicative homomorphism implies that an operation performed on ciphertexts results in a ciphertext that, when decrypted, is equivalent to the multiplication of the corresponding plaintexts
  2. Constructing New Ciphertext: A method must be found to combine (v1,e1)(v_1, e_1) and (v2,e2)(v_2, e_2) such that D(sk,combine(c1,c2))=m1m2D(sk, \text{combine}(c_1, c_2)) = m_1 \cdot m_2
  3. Specific Numerical Calculation: Perform actual calculations using the given parameters to verify the homomorphic property

Solution Key Points:

  • Utilize properties of group operations, especially exponent rules (ax)(ay)=ax+y(a^x)(a^y) = a^{x+y} and (ax)y=axy(a^x)^y = a^{xy}
  • Observe the ElGamal encryption process e=uβme = u^{\beta} \cdot m, where uβu^{\beta} acts as a mask
  • If c1=(v1,e1)c_1 = (v_1, e_1) corresponds to m1m_1, and c2=(v2,e2)c_2 = (v_2, e_2) corresponds to m2m_2, then e1=uβ1m1e_1 = u^{\beta_1} \cdot m_1 and e2=uβ2m2e_2 = u^{\beta_2} \cdot m_2
  • Consider multiplying e1e_1 and e2e_2: e1e2=(uβ1m1)(uβ2m2)=uβ1+β2(m1m2)e_1 \cdot e_2 = (u^{\beta_1} \cdot m_1) \cdot (u^{\beta_2} \cdot m_2) = u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)
  • Simultaneously, v1v2=gβ1gβ2=gβ1+β2v_1 \cdot v_2 = g^{\beta_1} \cdot g^{\beta_2} = g^{\beta_1+\beta_2}
  • Therefore, the new ciphertext c=(v1v2,e1e2)c = (v_1 \cdot v_2, e_1 \cdot e_2) takes the form of E(pk,m1m2)E(pk, m_1 \cdot m_2), where the random number is β1+β2\beta_1+\beta_2

Requirement 2: In-Depth Analysis of Additive Homomorphism

Requirement Description: Can the ElGamal encryption system be made additively homomorphic? Explain the solution and potential drawbacks.

Technical Challenges:

  1. ElGamal's Native Structure: ElGamal's encryption and decryption operations are inherently multiplicative and divisive, which naturally gives it multiplicative homomorphism. To achieve additive homomorphism, the message encoding method must be changed
  2. Message Encoding: The hint "try to encode the message in the exponent" suggests that the message mm is no longer directly a group element but rather an exponent of gmg^m
  3. Group Properties: The operation in group GG is multiplication, while we aim to achieve addition of plaintexts. This requires mapping plaintext addition to group element multiplication

Solution Key Points:

  • Message Encoding: Encode the plaintext message mm as gmg^m. This implies that mm must be an element of Zq\mathbb{Z}_q, or a small integer
  • Modified Encryption Process: E(pk,m)=βZq,vgβ,euβgmE'(pk, m) = \beta \leftarrow \mathbb{Z}_q, v \leftarrow g^{\beta}, e \leftarrow u^{\beta} \cdot g^m, output (v,e)(v, e)
  • Modified Decryption Process: D(sk,(v,e))=mD'(sk, (v, e)) = m. Decryption yields gmg^m, and then mm needs to be computed by solving the discrete logarithm problem
  • Additive Homomorphism Verification: Through multiplication of ciphertexts, we can obtain gm1+m2g^{m_1+m_2}, thereby achieving additive homomorphism for plaintexts

Potential Drawbacks:

  1. Decryption Difficulty: Recovering mm from gmg^m requires solving the discrete logarithm problem, which is computationally hard
  2. Message Space Limitations: The message mm must be an exponent, typically an integer, and its range is limited by the order qq of the group GG
  3. Efficiency Issues: The computational hardness of discrete logarithm computation is the foundation of ElGamal's security, but also a bottleneck for its use as an additively homomorphic scheme

Related Cryptographic Knowledge Points

  1. ElGamal Encryption: A public-key encryption scheme based on the discrete logarithm problem
  2. Homomorphic Encryption: An encryption scheme that allows computations to be performed on ciphertexts, yielding a result that, when decrypted, matches the result of the same computation performed on the plaintexts
    • Multiplicative Homomorphism: Ciphertext operations correspond to plaintext multiplication
    • Additive Homomorphism: Ciphertext operations correspond to plaintext addition
  3. Cyclic Groups and Discrete Logarithms: The mathematical foundation of ElGamal
  4. Laws of Exponents: Fundamental properties in group operations, crucial for implementing homomorphism

Standard Answer

Problem 1: Proof and Calculation for Multiplicative Homomorphism

Proof that EMEG possesses Multiplicative Homomorphism

Let the public key be pk=upk = u and the private key be α\alpha. We know that u=gαu = g^{\alpha}.

Step 1: Encrypt m1m_1

  • Choose a random number β1Zq\beta_1 \in \mathbb{Z}_q
  • c1=(v1,e1)=(gβ1,uβ1m1)c_1 = (v_1, e_1) = (g^{\beta_1}, u^{\beta_1} \cdot m_1)

Step 2: Encrypt m2m_2

  • Choose a random number β2Zq\beta_2 \in \mathbb{Z}_q
  • c2=(v2,e2)=(gβ2,uβ2m2)c_2 = (v_2, e_2) = (g^{\beta_2}, u^{\beta_2} \cdot m_2)

Step 3: Construct a new ciphertext cc To achieve the encryption of m1m2m_1 \cdot m_2, we perform multiplication on the components of c1c_1 and c2c_2:

  • v=v1v2=gβ1gβ2=gβ1+β2v = v_1 \cdot v_2 = g^{\beta_1} \cdot g^{\beta_2} = g^{\beta_1+\beta_2}
  • e=e1e2=(uβ1m1)(uβ2m2)=uβ1+β2(m1m2)e = e_1 \cdot e_2 = (u^{\beta_1} \cdot m_1) \cdot (u^{\beta_2} \cdot m_2) = u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)

The new ciphertext is c=(v,e)=(gβ1+β2,uβ1+β2(m1m2))c = (v, e) = (g^{\beta_1+\beta_2}, u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)).

Step 4: Verify by decrypting cc D(sk,c)=evα=uβ1+β2(m1m2)(gβ1+β2)α=uβ1+β2(m1m2)(gα)β1+β2=uβ1+β2(m1m2)uβ1+β2=m1m2D(sk, c) = \frac{e}{v^{\alpha}} = \frac{u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)}{(g^{\beta_1+\beta_2})^{\alpha}} = \frac{u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)}{(g^{\alpha})^{\beta_1+\beta_2}} = \frac{u^{\beta_1+\beta_2} \cdot (m_1 \cdot m_2)}{u^{\beta_1+\beta_2}} = m_1 \cdot m_2

Therefore, EMEG possesses multiplicative homomorphism. ✓

Specific Numerical Calculation Process

Given parameters:

  • g=3g = 3
  • q=5q = 5
  • G=gG = \langle g \rangle is a subgroup of Z11\mathbb{Z}_{11}
  • sk=α=9sk = \alpha = 9
  • pk=u=4pk = u = 4
  • m1=4m_1 = 4
  • m2=5m_2 = 5

First, verify u=gαmod11u = g^{\alpha} \bmod 11: 39mod11=(3534)mod11=(14)mod11=43^9 \bmod 11 = (3^5 \cdot 3^4) \bmod 11 = (1 \cdot 4) \bmod 11 = 4 Verification successful. ✓

Step 1: Encrypt m1=4m_1 = 4

  • Randomly choose β1Z5\beta_1 \in \mathbb{Z}_5. Assume β1=2\beta_1 = 2
  • v1=gβ1mod11=32mod11=9v_1 = g^{\beta_1} \bmod 11 = 3^2 \bmod 11 = 9
  • e1=uβ1m1mod11=424mod11=164mod11=54mod11=20mod11=9e_1 = u^{\beta_1} \cdot m_1 \bmod 11 = 4^2 \cdot 4 \bmod 11 = 16 \cdot 4 \bmod 11 = 5 \cdot 4 \bmod 11 = 20 \bmod 11 = 9
  • So c1=(9,9)c_1 = (9, 9)

Step 2: Encrypt m2=5m_2 = 5

  • Randomly choose β2Z5\beta_2 \in \mathbb{Z}_5. Assume β2=3\beta_2 = 3
  • v2=gβ2mod11=33mod11=27mod11=5v_2 = g^{\beta_2} \bmod 11 = 3^3 \bmod 11 = 27 \bmod 11 = 5
  • e2=uβ2m2mod11=435mod11=645mod11=95mod11=45mod11=1e_2 = u^{\beta_2} \cdot m_2 \bmod 11 = 4^3 \cdot 5 \bmod 11 = 64 \cdot 5 \bmod 11 = 9 \cdot 5 \bmod 11 = 45 \bmod 11 = 1
  • So c2=(5,1)c_2 = (5, 1)

Step 3: Construct the new ciphertext cc

  • v=v1v2mod11=95mod11=45mod11=1v = v_1 \cdot v_2 \bmod 11 = 9 \cdot 5 \bmod 11 = 45 \bmod 11 = 1
  • e=e1e2mod11=91mod11=9e = e_1 \cdot e_2 \bmod 11 = 9 \cdot 1 \bmod 11 = 9
  • So the new ciphertext is c=(1,9)c = (1, 9)

Step 4: Decrypt cc to verify the result D(sk,c)=evαmod11=919mod11=91mod11=9D(sk, c) = \frac{e}{v^{\alpha}} \bmod 11 = \frac{9}{1^9} \bmod 11 = \frac{9}{1} \bmod 11 = 9

Expected result: m1m2=45mod11=20mod11=9m_1 \cdot m_2 = 4 \cdot 5 \bmod 11 = 20 \bmod 11 = 9

The decryption result 99 matches the expected result 99. ✓

Problem 2: Additive Homomorphism of ElGamal

Solution: Encoding the Message in the Exponent

To make ElGamal additively homomorphic, we need to change the message encoding by representing the plaintext mm as a group element gmg^m.

Modified Encryption Process (E)(E'):

  • Input: Public key pk=upk = u, message mZqm \in \mathbb{Z}_q (or a small integer range)
  • Steps:
    1. Randomly choose βZq\beta \in \mathbb{Z}_q
    2. Compute v=gβv = g^{\beta}
    3. Compute e=uβgme = u^{\beta} \cdot g^m
  • Output: Ciphertext (v,e)(v, e)

Modified Decryption Process (D)(D'):

  • Input: Private key sk=αsk = \alpha, ciphertext (v,e)(v, e)
  • Steps:
    1. Compute temp=evα=uβgm(gβ)α=(gα)βgm(gα)β=gmtemp = \frac{e}{v^{\alpha}} = \frac{u^{\beta} \cdot g^m}{(g^{\beta})^{\alpha}} = \frac{(g^{\alpha})^{\beta} \cdot g^m}{(g^{\alpha})^{\beta}} = g^m
    2. Recover mm from gmg^m. This requires solving the discrete logarithm problem: m=logg(temp)m = \log_g(temp)
  • Output: Plaintext mm

Additive Homomorphism Verification: Let c1=(v1,e1)c_1 = (v_1, e_1) correspond to gm1g^{m_1}, and c2=(v2,e2)c_2 = (v_2, e_2) correspond to gm2g^{m_2}.

Construct a new ciphertext c=(v1v2,e1e2)c = (v_1 \cdot v_2, e_1 \cdot e_2).

Decrypting cc yields: e1e2(v1v2)α=(uβ1gm1)(uβ2gm2)(gβ1gβ2)α=uβ1+β2gm1+m2(gβ1+β2)α=uβ1+β2gm1+m2uβ1+β2=gm1+m2\frac{e_1 \cdot e_2}{(v_1 \cdot v_2)^{\alpha}} = \frac{(u^{\beta_1} \cdot g^{m_1}) \cdot (u^{\beta_2} \cdot g^{m_2})}{(g^{\beta_1} \cdot g^{\beta_2})^{\alpha}} = \frac{u^{\beta_1+\beta_2} \cdot g^{m_1+m_2}}{(g^{\beta_1+\beta_2})^{\alpha}} = \frac{u^{\beta_1+\beta_2} \cdot g^{m_1+m_2}}{u^{\beta_1+\beta_2}} = g^{m_1+m_2}

Therefore, by computing c=(v1v2,e1e2)c = (v_1 \cdot v_2, e_1 \cdot e_2), we obtain gm1+m2g^{m_1+m_2}, thereby achieving additive homomorphism for the plaintexts. ✓

Potential Drawbacks
  1. Decryption Difficulty (Core Issue):

    • Recovering mm from gmg^m requires computing the discrete logarithm
    • For groups of large prime order qq, the discrete logarithm problem is computationally hard
    • This means that unless the message space for mm is extremely small (e.g., mm can only be small integers between 0 and 100, solvable by brute force), practical decryption is impossible
    • This severely limits its utility
  2. Message Space Limitations:

    • The message mm must be an exponent, typically an integer, and its range is limited by the order qq of the group GG
    • This restricts the types and sizes of messages that can be encrypted
  3. Efficiency Issues:

    • Even for a small message space, decryption requires discrete logarithm computation (e.g., via precomputed tables or Pohlig-Hellman algorithm, but these methods are only effective for specific small ranges or special group structures)
    • This is generally much slower than direct group operations (multiplication, inversion)
  4. Security Concerns:

    • If the message space is too small, attacks against the discrete logarithm problem might become feasible, potentially compromising the security of the encryption

Summary: Although encoding the message in the exponent can theoretically enable additive homomorphism for ElGamal, the computational infeasibility of solving the discrete logarithm problem for decryption (unless the message space is very limited) makes this modification impractical for a fully functional additively homomorphic scheme in real-world applications.


Summary

Key Knowledge Points

  1. ElGamal's Multiplicative Homomorphism: Through multiplication of ciphertext components, multiplicative homomorphism for plaintexts can be achieved
  2. Difficulty of Additive Homomorphism: Although theoretically achievable through encoding, decryption requires solving the discrete logarithm problem, limiting practicality
  3. Applications of Homomorphic Encryption: Homomorphic encryption has important applications in privacy-preserving computation, electronic voting, and other fields

Notes for Practical Applications

  1. Practicality of Multiplicative Homomorphism: ElGamal's multiplicative homomorphism is useful in practical applications, such as vote counting in electronic voting systems
  2. Limitations of Additive Homomorphism: Although additive homomorphism can be achieved through encoding, due to decryption difficulty, specialized schemes (such as Paillier encryption) are usually needed to achieve practical additive homomorphism