← 返回资讯屏轩教育 · 行业资讯

A-Level OCR Computer Science: Encryption Revision Guide | A-Level OCR 计算机:加密考点精讲

2026-07-14 10:42 · 本文部分内容由AI辅助创作

📚 A-Level OCR Computer Science: Encryption Revision Guide | A-Level OCR 计算机:加密考点精讲

Encryption lies at the heart of modern digital security, underpinning everything from online banking to private messaging. In the A-Level OCR Computer Science specification, a strong understanding of encryption is essential, covering symmetric and asymmetric methods, the mathematics of RSA, hashing, digital signatures, and the protocols that keep the internet secure. This revision guide is designed to help you master these concepts, with paired English and Chinese explanations that follow the depth and style required by OCR examiners.

加密是现代数字安全的核心,支撑着从网上银行到私人消息的一切。在 A-Level OCR 计算机科学规范中,扎实掌握加密知识至关重要,涵盖对称和非对称方法、RSA 数学原理、哈希、数字签名以及保障互联网安全的协议。本复习指南旨在帮助你掌握这些概念,中英对照的讲解方式符合 OCR 考官所要求的深度与风格。

1. What is Encryption? | 什么是加密?

Encryption is the process of converting plaintext into ciphertext using an algorithm and a key, making the data unreadable to anyone who does not have the key to decrypt it. The core goal is confidentiality, ensuring that even if data is intercepted, it cannot be understood.

加密是使用算法和密钥将明文转换为密文的过程,使任何没有解密密钥的人都无法读取数据。其核心目标是机密性,确保即使数据被截获,也无法被理解。

In modern systems, encryption is not just about hiding messages; it also supports integrity checks, authentication, and non-repudiation. The strength of an encryption scheme depends on the algorithm and the secrecy of the key, not on keeping the algorithm secret (Kerckhoffs's principle).

在现代系统中,加密不仅用于隐藏消息,还支持完整性校验、身份验证和不可否认性。加密方案的强度取决于算法和密钥的保密性,而非算法的保密性(柯克霍夫原则)。


2. The Need for Encryption | 加密的必要性

Without encryption, sensitive personal data, financial transactions, and state secrets would be vulnerable to eavesdropping and theft. The rapid growth of the internet and cloud computing has made encryption a fundamental right for privacy and a necessity for trust in digital infrastructure.

没有加密,敏感的个人数据、金融交易和国家机密将容易受到窃听和盗窃的威胁。互联网和云计算的快速发展,使加密成为隐私的基本权利和数字基础设施中信任的必需。

Encryption protects data at rest (stored on a device) and data in transit (sent over a network). For example, full-disk encryption on a laptop and TLS during web browsing both rely on robust cryptographic techniques to prevent unauthorised access.

加密可以保护静态数据(存储在设备上)和传输中的数据(通过网络发送)。例如,笔记本电脑的全盘加密和网页浏览中使用的 TLS,都依赖强大的密码学技术来防止未经授权的访问。

Moreover, regulations such as GDPR require organisations to implement appropriate technical measures, including encryption, to safeguard personal data. Failing to encrypt can lead to severe legal and financial penalties.

此外,GDPR 等法规要求组织采取适当的技术措施(包括加密)来保护个人数据。不加密可能会招致严重的法律和经济处罚。


3. Symmetric Encryption | 对称加密

Symmetric encryption uses a single shared key for both encryption and decryption. The sender and receiver must both possess this secret key, which must be exchanged securely beforehand. Common symmetric algorithms include AES (Advanced Encryption Standard) and DES (Data Encryption Standard).

对称加密使用同一个共享密钥进行加密和解密。发送方和接收方都必须拥有这个秘密密钥,并且必须事先安全地交换密钥。常见的对称算法包括 AES(高级加密标准)和 DES(数据加密标准)。

Symmetric Encryption | 对称加密 Details | 详情
Key characteristic Same key for encryption and decryption | 加密和解密使用相同密钥
Main advantage Fast and efficient, suitable for bulk data | 快速高效,适合大量数据
Key challenge Secure key distribution | 密钥的安全分发
Example algorithms AES (128/256-bit), DES, 3DES, Blowfish

Symmetric ciphers can operate as stream ciphers (encrypting one bit or byte at a time) or block ciphers (encrypting fixed-size blocks). AES, a block cipher, is widely adopted due to its speed and security, using key sizes of 128, 192, or 256 bits.

对称密码可以按流密码(一次加密一位或一个字节)或分组密码(加密固定大小的块)的方式工作。AES 是一种分组密码,因其速度和安全性而被广泛采用,密钥长度可为 128、192 或 256 位。


4. Classic Ciphers: Caesar and Vigenère | 经典密码:凯撒与维吉尼亚

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, with a shift of 3, 'A' becomes 'D', 'B' becomes 'E', and so on. It is extremely weak, as there are only 25 possible shifts to try.

凯撒密码是一种替换密码,其明文中每个字母在字母表中移动固定数量的位置。例如,偏移量为 3 时,'A' 变为 'D','B' 变为 'E',依此类推。它极弱,因为只有 25 种可能的位移可供尝试。

The Vigenère cipher improves on Caesar by using a keyword to determine a series of different shifts, making it a polyalphabetic cipher. The key is repeated to match the length of the plaintext. While stronger than a simple substitution, it can still be broken through frequency analysis, especially if the key is short.

维吉尼亚密码改进了凯撒密码,使用一个关键词来确定一系列不同的位移量,使其成为一种多表替换密码。密钥被重复使用以匹配明文长度。虽然比简单替换强,但仍可通过频率分析破解,尤其是当密钥较短时。

Both ciphers taught in OCR are important for understanding the evolution of cryptography, but they are not used in any secure modern system. Their weakness demonstrates the need for algorithms that resist statistical attacks.

OCR 课程中教授的这两种密码,对于理解密码学演变非常重要,但它们不在任何安全的现代系统中使用。它们的弱点表明需要能够抵抗统计攻击的算法。


5. The Vernam Cipher and Perfect Secrecy | 弗纳姆密码与完美保密性

The Vernam cipher, also known as the one-time pad, is a symmetric stream cipher that provides perfect secrecy if implemented correctly. It combines the plaintext bitstream with a truly random key stream of the same length using the XOR operation. The ciphertext reveals no information about the plaintext without the key.

弗纳姆密码,也称为一次性密码本,是一种对称流密码,如果实现得当,能提供完美保密性。它使用异或(XOR)操作将明文比特流与等长的真正随机密钥流相结合。密文在没有密钥的情况下不会泄露有关明文的任何信息。

Ciphertext = Plaintext XOR Keystream

The key requirements are: the key must be truly random, at least as long as the message, used only once, and kept completely secret. If any of these conditions is violated, the security collapses, as seen in historical failures where the one-time pad was reused.

密钥要求是:密钥必须真正随机、长度至少与消息相同、只使用一次并完全保密。如果违反任意条件,安全性就会崩溃,正如历史上重复使用一次性密码本导致的失败案例。

Because generating and distributing long, truly random keys is impractical for most applications, the one-time pad is rarely used. However, it remains a theoretical benchmark for evaluating encryption strength. Quantum key distribution is a modern way to enable secure one-time pad communication over fibre optics.

由于为大多数应用生成和分发很长的真正随机密钥不切实际,一次性密码本很少被使用。然而,它仍然是评估加密强度的理论基准。量子密钥分发是一种在现代光纤上实现安全一次性密码本通信的方法。


6. Asymmetric Encryption | 非对称加密

Asymmetric encryption, also called public-key cryptography, uses a pair of mathematically related keys: a public key for encryption and a private key for decryption. The public key can be shared openly, while the private key remains secret. This solves the key distribution problem inherent in symmetric systems.

非对称加密,也称为公钥密码学,使用一对数学上相关的密钥:用于加密的公钥和用于解密的私钥。公钥可以公开共享,而私钥保持秘密。这解决了对称系统中固有的密钥分发问题。

The main advantage of asymmetric encryption is that communicating parties do not need to share a secret beforehand. However, it is much slower than symmetric encryption and is computationally intensive due to the large numbers involved. Common algorithms include RSA, Diffie-Hellman key exchange, and Elliptic Curve Cryptography (ECC).

非对称加密的主要优点是通信方无需事先共享秘密。然而,它比对称加密慢得多,并且由于涉及大数运算而计算密集。常见算法包括 RSA、Diffie-Hellman 密钥交换和椭圆曲线密码学 (ECC)。

In hybrid systems, asymmetric encryption is used only to securely exchange a symmetric session key, which then handles the bulk data encryption. This combines the security of public-key cryptography with the speed of symmetric ciphers.

在混合系统中,非对称加密仅用于安全交换对称会话密钥,然后由对称密钥处理大量数据加密。这结合了公钥密码学的安全性和对称密码的速度。


广告 / Sponsored

7. The RSA Algorithm | RSA 算法

RSA (Rivest–Shamir–Adleman) is the most widely taught asymmetric algorithm. It relies on the difficulty of factoring the product of two large prime numbers. The key generation process is:

RSA(Rivest–Shamir–Adleman)是教学中最常学习的非对称算法。它依赖于分解两个大素数之积的困难性。密钥生成过程如下:

φ(n)) = 1. Compute the private exponent d as the modular inverse of e modulo φ(n), i.e., d ≡ e⁻¹ mod φ(n). The public key is (e, n) and the private key is (d, n).

选择两个不同的大素数 p 和 q。计算 n = p × q 以及 φ(n) = (p−1)(q−1)。选择一个公钥指数 e,满足 1 < e < φ(n) 且 gcd(e, φ(n)) = 1。计算私钥指数 d 作为 e 模 φ(n) 的模逆,即 d ≡ e⁻¹ mod φ(n)。公钥为 (e, n),私钥为 (d, n)。

Encryption: c = mᵉ mod n

Decryption: m = cᵈ mod n

RSA’s security rests on the fact that, given only n, it is computationally infeasible to determine p and q when they are sufficiently large (typically 2048 bits or more). However, if an attacker can factor n, they can compute d and break the scheme.

RSA 的安全性在于,仅给定 n 时,只要 p 和 q 足够大(通常 2048 位或以上),在计算上确定它们是不可行的。然而,如果攻击者能够分解 n,他们就能计算出 d 并破解方案。

OCR candidates should be able to trace simple RSA calculations with small numbers, understanding the roles of e, d, n, and φ(n). They must also appreciate that RSA is rarely used to encrypt whole messages; instead it encrypts symmetric keys or creates digital signatures.

OCR 考生应能使用小数字跟踪简单的 RSA 计算,理解 e、d、n 和 φ(n) 的作用。他们还必须认识到 RSA 很少用于加密完整消息,而是用来加密对称密钥或创建数字签名。


8. Hybrid Encryption in Practice | 实践中的混合加密

Because asymmetric encryption is slow, modern secure communications use a hybrid model. The initial handshake uses asymmetric cryptography (such as RSA or Diffie-Hellman) to establish a shared secret session key. This session key is then used with a fast symmetric cipher like AES for the remainder of the connection.

由于非对称加密速度慢,现代安全通信采用混合模型。初始握手使用非对称密码学(如 RSA 或 Diffie-Hellman)建立一个共享的秘密会话密钥。之后,该会话密钥与 AES 等快速对称密码一起用于连接的其余部分。

This approach is fundamental to protocols like TLS (Transport Layer Security), which secures HTTPS connections. The ephemeral nature of the session key also provides forward secrecy if Diffie-Hellman key exchange is used, meaning past sessions cannot be decrypted even if the long-term private key is later compromised.

这种方法对于保护 HTTPS 连接的 TLS(传输层安全)等协议至关重要。如果使用 Diffie-Hellman 密钥交换,会话密钥的短暂性还能提供前向保密,意味着即使长期私钥后来被泄露,过去的会话也无法解密。

In the handshake, the server typically sends its certificate containing the public key. The client generates a pre-master secret, encrypts it with the server's public key, and sends it back. Both sides then derive the same symmetric session key from this secret.

在握手中,服务器通常会发送包含其公钥的证书。客户端生成一个预主秘密,用服务器公钥加密后发回。然后双方从这个秘密派生出相同的对称会话密钥。


9. Hashing and Data Integrity | 哈希与数据完整性

A hash function takes an input (or message) and returns a fixed-size string of bytes, known as the hash value or digest. Key properties include: deterministic (same input always gives same hash), fast to compute, pre-image resistant (cannot reverse it), collision resistant (hard to find two inputs with same hash), and the avalanche effect (a small change in input changes the hash drastically).

哈希函数接受一个输入(或消息),并返回一个固定大小的字节串,称为哈希值或摘要。关键属性包括:确定性(相同输入总是产生相同哈希)、计算快速、抗原像(不可逆)、抗碰撞(很难找到两个输入产生相同哈希)以及雪崩效应(输入的微小变化会导致哈希剧烈变化)。

Common hashing algorithms are SHA-256 (part of the SHA-2 family) and MD5. MD5 is now considered broken due to collision vulnerabilities. In the OCR syllabus, hashing is used to verify data integrity (e.g., checksums for downloads) and as a building block for digital signatures.

常见的哈希算法有 SHA-256(SHA-2 家族的一部分)和 MD5。MD5 由于碰撞漏洞现已被认为不安全。在 OCR 教学大纲中,哈希用于验证数据完整性(例如下载的校验和)以及作为数字签名的构建模块。

When storing passwords, systems apply salted hashing: a random salt is combined with the password before hashing, storing both the salt and the hash. This defeats rainbow table attacks and ensures identical passwords do not produce the same hash.

存储密码时,系统会使用加盐哈希:在哈希之前先将一个随机盐值与密码结合,并存储盐值和哈希值。这可以击败彩虹表攻击,确保相同密码不会产生相同的哈希值。

Hash = H(message)


10. Digital Signatures and Authentication | 数字签名与认证

A digital signature provides authentication, integrity, and non-repudiation. It is created by hashing the message and then encrypting the hash with the sender's private key. The recipient can verify the signature by decrypting it with the sender's public key and comparing the hash they compute themselves.

数字签名提供了身份验证、完整性和不可否认性。它通过先对消息进行哈希,再用发送方的私钥加密该哈希值来创建。接收方可以用发送方的公钥解密签名,并与自己计算的哈希值进行比较,从而验证签名。

If the two hashes match, the recipient knows the message has not been altered and that it genuinely came from the holder of the private key. Because only the sender possesses the private key, they cannot later deny having sent the message — this is non-repudiation.

如果两个哈希值匹配,接收方便知道消息未被篡改,且确实来自私钥持有者。由于只有发送方拥有私钥,他们事后无法否认发送过该消息——这就是不可否认性。

Digital signatures are crucial in software distribution (code signing), legal documents, and cryptocurrency transactions. In the OCR exam, candidates may be asked to describe the process or explain how it differs from encryption-only scenarios.

数字签名在软件分发(代码签名)、法律文件和加密货币交易中至关重要。在 OCR 考试中,考生可能被要求描述该过程或解释它与仅加密场景的区别。


11. Public Key Infrastructure (PKI) | 公钥基础设施

PKI is the framework of roles, policies, and technologies needed to manage digital certificates and public-key encryption. Its core component is the Certificate Authority (CA), a trusted third party that issues and revokes digital certificates, binding a public key to an entity's identity.

PKI 是管理数字证书和公钥加密所需的角色、策略和技术的框架。其核心组件是证书颁发机构 (CA),一个受信任的第三方,负责颁发和吊销数字证书,将公钥与实体身份绑定。

A digital certificate contains the owner's public key, identity information, validity period, and the CA's digital signature. When a client connects to a server, it checks the certificate chain up to a trusted root CA. If the chain is valid and none of the certificates have been revoked (via CRL or OCSP), trust is established.

数字证书包含持有者的公钥、身份信息、有效期和 CA 的数字签名。当客户端连接到服务器时,它会向上检查证书链直至受信任的根 CA。如果链有效且没有证书被吊销(通过 CRL 或 OCSP),则信任建立。

PKI is the foundation of HTTPS, email encryption (S/MIME), and VPN authentication. Understanding the trust model helps explain why self-signed certificates trigger browser warnings — they lack the backing of a recognised CA.

PKI 是 HTTPS、电子邮件加密 (S/MIME) 和 VPN 认证的基础。理解信任模型有助于解释为什么自签名证书会触发浏览器警告——它们缺乏被认可的 CA 背书。


12. SSL/TLS: Securing the Web | SSL/TLS:保护网络

TLS (Transport Layer Security), the successor to SSL, is the protocol that encrypts data between a web browser and a server, ensuring secure HTTP (HTTPS). It uses a combination of symmetric and asymmetric cryptography, hashing, and digital certificates to provide confidentiality, integrity, and authentication.

TLS(传输层安全),SSL 的继任者,是加密 Web 浏览器与服务器之间数据的协议,确保安全的 HTTP(HTTPS)。它结合使用了对称与非对称密码学、哈希和数字证书,以提供机密性、完整性和身份验证。

The TLS handshake begins with a client hello, followed by the server sending its certificate. After certificate validation, they agree on cipher suites and perform a key exchange (often using ephemeral Diffie-Hellman). The resulting session keys then protect the application data with symmetric encryption and authenticated encryption modes.

TLS 握手以客户端问候开始,随后服务器发送其证书。证书验证通过后,双方协商密码套件并执行密钥交换(通常使用短暂 Diffie-Hellman)。生成的会话密钥随后用对称加密和认证加密模式保护应用数据。

Modern TLS 1.3 reduces the number of round trips and removes outdated algorithms, making connections faster and more secure. As an A-Level student, you should be able to identify the role of encryption, hashing, and public keys within the TLS ecosystem.

现代 TLS 1.3 减少了往返次数并移除了过时算法,使连接更快、更安全。作为 A-Level 学生,你应该能够识别加密、哈希和公钥在 TLS 生态系统中的作用。

Published by TutorHao | Computer Science Revision Series | aleveler.com

广告 / Sponsored
现货 Cambridge International AS & ALevel IT Coursebook剑桥国际IGC…
计算机 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥467.0

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

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao