Introduce
Mode of operation (操作模式)是指将分组密码应用于实际数据加密时所采用的工作方式。常见的操作模式包括ECB(电子密码本模式)、CBC(密码分组链接模式)、CFB(密码反馈模式)、OFB(输出反馈模式)和CTR(计数器模式)等。由于分组密码每次只能加密固定长度的数据块,操作模式的作用是确保其能安全有效地处理多块数据,防止相同明文块加密成相同密文,从而提升整体安全性。不同模式在安全性、效率和适用场景上各有特点,例如CBC适用于文件加密,CTR适合并行处理。选择合适操作模式对于保障数据机密性和完整性至关重要。
Mode of operation
AEAD
AEAD的概念: 在通常的密码学应用中,Confidentiality (保密) 用加密实现,Message authentication (消息认证) 用MAC实现。这两种算法的配合方式,引发了很多安全漏洞,过去曾经有3种方法:
- Encrypt-and-MAC
- MAC-then-Encrypt
- Encrypt-then-MAC
后来发现,1和2都是有安全问题的,所以,2008年起, 逐渐提出了“用一个算法在内部同时实现Cipher+MAC”的idea,称为AEAD(Authenticated encryption with additional data)。 在AEAD这种概念里,Cipher+MAC 被 一个AEAD算法替换。
算法如: AES-CCM
、
AES-GCM
、
ChaCha20Poly1305
…
CBC
CFB
CTR
ECB
![]() | ![]() | ![]() |
Original image | Encrypted using ECB mode | Modes other than ECB result in pseudo-randomness |
The image on the right is how the image might appear encrypted with CBC, CTR or any of the other more secure modes—indistinguishable from random noise. Note that the random appearance of the image on the right does not ensure that the image has been securely encrypted; many kinds of insecure encryption have been developed which would produce output just as “random-looking”. |
GCM
OFB
PCBC
Reference
- h
t - Block cipher mode of operationt p s : / / e n . w i k i p e d i a . o r g / w i k i / B l o c k _ c i p h e r _ m o d e _ o f _ o p e r a t i o n - h
t - 现代密码学实践指南[2015年]t p s : / / b l o g . h e l o n g . i n f o / b l o g / 2 0 1 5 / 0 6 / 0 6 / m o d e r n - c r y p t o /