初始化向量的特征
我绝不是密码学专家,我一直在阅读 Stack Overflow 和维基百科上的一些问题,但在定义 IV 及其用法方面没有什么是真正“明确的”。
我发现的要点:
- IV 被添加到明文消息中以加强加密
- IV 是真正随机的
- 每条消息都有自己独特的 IV
- 时间戳,有时使用加密哈希来代替随机值,但这些被认为是不安全的因为时间戳是可以预测的
- WEP(在 802.11 中)的弱点之一是 IV 将在特定数量的加密后重置,从而重复 IV
我确信还有许多其他点待制作,有人能想到我错过的任何其他特征吗?
I'm by no means a cryptography expert, I have been reading a few questions around Stack Overflow and on Wikipedia but nothing is really 'clear cut' in terms of defining an IV and its usage.
Points I have discovered:
- An IV is prepended to a plaintext message in order to strengthen the encryption
- The IV is truely random
- Each message has its own unique IV
- Timestamps and cryptographic hashes are sometimes used instead of random values, but these are considered to be insecure as timestamps can be predicted
- One of the weaknesses of WEP (in 802.11) is the fact that the IV will reset after a specific amount of encryptions, thus repeating the IV
I'm sure there are many other points to be made, can anyone think of any other characteristics which I've missed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IV 是“影响加密过程的公共值”。 IV 的要点通常是“随机化”输入数据,以避免泄漏有关哪些输入块在明文中相同的信息(因为相同的块在“现实生活”数据中出现很多)。
IV 是否通过预先添加或以其他方式输入取决于使用它的算法。对于 CBC 模式下使用分组密码的对称加密,IV 被添加到加密数据之前(对于每个块,CBC 使用前一个加密块;IV 扮演加密块的角色) -1)。
IV 与密钥的不同之处在于密钥是秘密的,而 IV 不需要是秘密的; IV 通常与加密消息一起传输。相反,每条消息的 IV 必须是不同的,而密钥可以重复使用。实际上,对于使用相同密钥加密的每条消息,IV 必须是不同的;如果你为每条消息使用一个新密钥,那么你可以使用一个恒定的、固定的 IV。请注意,IV不需要保密,但如果您愿意,可以保密。但发送者和接收者必须就 IV 达成一致,并且由于 IV 每条消息都会发生变化,因此在某些设置中,保持 IV 的秘密可能会很不方便。
IV 是否必须是均匀随机的,或者只是不重复,取决于算法。 CBC 需要随机 IV。其他模式则不太挑剔,例如 GCM。您可以使用适当的单向函数从“主密钥”导出密钥和 IV。这就是 SSL 的作用。这看起来更棘手,不要在家尝试。
重复 IV 是 WEP 的众多罪过之一。
An IV is "a public value which impacts the encryption process". The point of the IV is often to "randomize" the input data to avoid leaking information about which input blocks were identical in the plaintext (because identical blocks happen quite a lot in "real-life" data).
Whether the IV is input by pre-pending it or otherwise depends on the algorithm in which it is used. For symmetric encryption with a block cipher in CBC mode, the IV is pre-pended to the encrypted data (CBC uses, for each block, the previous encrypted block; the IV plays the role of the encrypted block -1).
An IV is distinct from a key in that a key is secret whereas the IV needs not be secret; the IV is often transmitted along the encrypted message. Conversely, the IV must be distinct for every message, whereas the key may be reused. Actually, the IV must be distinct for every message encrypted with the same key; if you use a new key for every message then you can use a constant, fixed IV. Note that the IV needs not be secret, but you can keep it secret if you wish. But the sender and the receiver must agree on the IV, and since the IV changes for every message then it can be inconvenient, in some setups, to keep IV secret.
Whether the IV must be uniformly random, or simply non-repeating, depends on the algorithm. CBC requires a random IV. Other modes are less picky, e.g. GCM. You may derive the key and the IV from a "master key", using a proper one-way function. This is what SSL does. It is more tricky that it seems, do not try it at home.
Repeating the IV is one of the numerous sins of WEP.