Encryption Key Points for CIE A-Level Computer Science | CIE A-Level 计算机 加密考点精讲

📚 Encryption Key Points for CIE A-Level Computer Science | CIE A-Level 计算机 加密考点精讲

Encryption is a cornerstone of cybersecurity, ensuring that sensitive data remains confidential during storage and transmission. In the CIE A-Level Computer Science syllabus, you must understand symmetric and asymmetric encryption, classic ciphers like Caesar and Vernam, how public-key cryptography enables key exchange and digital signatures, and the role of protocols such as SSL/TLS in securing the web. This guide covers all essential exam points with clear explanations and examples.

加密是网络安全的基石,保证敏感数据在存储和传输过程中保持机密。在CIE A-Level计算机科学大纲中,你必须理解对称和非对称加密、如凯撒和维吉尼亚(一次性密码本)等经典密码、公钥密码如何实现密钥交换和数字签名,以及SSL/TLS等协议在保护网络通信中的角色。本指南以清晰的解释和示例覆盖所有重要考点。


1. Encryption Fundamentals | 加密基础

Encryption transforms readable plaintext into ciphertext using an algorithm and a key. Decryption reverses this with a decryption key. In symmetric encryption, the same key is used for both; in asymmetric encryption, different keys are used.

加密使用算法和密钥将可读明文转换为密文。解密用解密密钥逆转此过程。对称加密中,加密解密用同一密钥;非对称加密中使用不同密钥。

The primary goal is confidentiality, but encryption also supports integrity (via hashes) and non-repudiation (via digital signatures) when combined with other techniques.

主要目标是机密性,但结合其他技术时加密也可支持完整性(用哈希)和不可否认性(用数字签名)。


2. Symmetric Encryption | 对称加密

Symmetric encryption uses the same secret key for both encryption and decryption. Both communicating parties must possess a shared key, which leads to the key distribution problem: how to securely share that key over an insecure channel.

对称加密使用同一秘密密钥进行加密和解密。通信双方都必须持有共享密钥,这带来了密钥分发问题:如何在不安全信道安全地共享该密钥。

Common symmetric algorithms include AES and DES. They are fast and suitable for bulk data, but key management becomes complex when many parties are involved.

常见的对称算法包括AES和DES。它们速度快,适合大量数据,但当涉及多方时密钥管理变得复杂。


3. Caesar Cipher | 凯撒密码

The Caesar cipher is a substitution cipher where each letter in the plaintext is shifted by a fixed number of positions in the alphabet. For example, a shift of 3 turns ‘A’ → ‘D’, ‘B’ → ‘E’, and ‘Z’ → ‘C’ (wrapping around).

凯撒密码是一种替换密码,明文中的每个字母在字母表中向后移动固定位数。例如移位3,则 ‘A’ → ‘D’,’B’ → ‘E’,’Z’ → ‘C’(循环)。

With only 25 possible shifts, it is extremely weak and can be trivially broken by brute-force or frequency analysis.

只有25种可能的移位,它非常脆弱,通过暴力破解或频率分析即可轻易破解。


4. Vernam Cipher & One-Time Pad | 维吉尼亚密码和一次性密码本

The Vernam cipher encrypts binary data by XORing (⊕) each plaintext bit with a corresponding key-stream bit. If the key is truly random, as long as the plaintext, and used only once, the cipher is theoretically unbreakable — the one-time pad.

维吉尼亚密码通过将每个明文比特与对应的密钥流比特进行异或(⊕)来加密二进制数据。如果密钥真正随机、长度与明文相等且只使用一次,则密码在理论上是不可破解的——这就是一次性密码本。

For example, plaintext byte 01000001 (A) XOR with random key 10101010 gives ciphertext 11101011. Decryption is achieved by XORing again with the same key: 11101011 ⊕ 10101010 = 01000001.

例如明文字节 01000001 (A) 与随机密钥 10101010 异或得到密文 11101011。解密时再次与相同密钥异或:11101011 ⊕ 10101010 = 01000001。

This cipher is perfectly secure because without the key, every possible plaintext of the same length is equally likely. However, practical key distribution and true randomness requirements limit its use.

该密码绝对安全,因为没有密钥时,每种相同长度的明文可能性都相等。然而,实际的密钥分发和真随机要求限制了它的使用。


5. Asymmetric Encryption | 非对称加密

Asymmetric encryption uses a key pair: a public key (shared openly) and a private key (kept secret). A message encrypted with the public key can only be decrypted with the corresponding private key.

非对称加密使用密钥对:公开密钥(公开共享)和私有密钥(保密)。用公钥加密的消息只能用对应的私钥解密。

This solves the key distribution problem — anyone can encrypt using the recipient’s public key, but only the recipient can decrypt. It also enables digital signatures by reversing the function: signing with private key, verifying with public key.

这解决了密钥分发问题——任何人都可以使用收件人的公钥加密,但只有收件人能解密。它还通过反向使用实现数字签名:用私钥签名,公钥验证。

However, asymmetric encryption is computationally slower than symmetric encryption, so it is typically used to exchange a symmetric session key, which then encrypts the bulk data.

然而,非对称加密比对称加密计算速度慢,因此通常用于交换对称会话密钥,然后用对称密钥加密大量数据。


6. RSA Algorithm Essentials | RSA算法基础

RSA is based on the difficulty of factoring large composite numbers. Key generation: pick two large primes p and q, compute n = p × q, and φ(n) = (p-1)(q-1). Choose e (public exponent) such that 1 < e < φ(n) and gcd(e, φ(n)) = 1. Compute d as the modular multiplicative inverse of e modulo φ(n). Public key = (e, n), private key = (d, n).

RSA基于大合数分解的困难性。密钥生成:选取大质数p和q,计算n = p × q,以及φ(n) = (p-1)(q-1)。选择e(公开指数)使得1 < e < φ(n)且gcd(e, φ(n)) = 1。计算d为e模φ(n)的模逆元。公钥 = (e, n),私钥 = (d, n)。

Encryption: C = Me mod n. Decryption: M = Cd mod n. (M is the plaintext as integer.)

加密:C = Me mod n。解密:M = Cd mod n。(M为整数形式的明文。)

A toy example: p=3, q=11 → n=33, φ=20. Choose e=7 (coprime with 20). Compute d such that (7 × d) mod 20 = 1 → d=3. Then encrypt M=2: C = 2⁷ mod 33 = 128 mod 33 = 29. Decrypt C=29: M = 29³ mod 33 = 24389 mod 33 = 2.

一个简单示例:p=3, q=11 → n=33, φ=20。选择e=7(与20互质)。计算d使得 (7 × d) mod 20 = 1 → d=3。加密M=2:C = 2⁷ mod 33 = 128 mod 33 = 29。解密密文29:M = 29³ mod 33 = 24389 mod 33 = 2。

The security of RSA lies in the infeasibility of factorising n back into p and q for sufficiently large primes (e.g., 2048 bits).

Published by TutorHao | A-Level Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version