是否曾经建议使用 ECB 密码模式?
从这篇关于密码模式的维基百科文章以及我听说过的有关 ECB 的其他内容来看,这是一个这是大忌,并且可能会泄露有关您的加密数据的信息。然而,网上仍然有很多利用 ECB 的示例:
使用欧洲央行是否可以接受或有利?
如果数据非常小(一个块)并且您使用两者盐和IV,可以吗?如果是的话,停止使用的门槛在哪里?
Judging from this Wikipedia article on cipher modes and other things I've heard about ECB, it's a big no-no and can leak information about your encrypted data. However, there are still plenty of examples out there on the 'net that utilize ECB:
Is it ever acceptable or advantageous to use ECB?
If the data is very small (one block) and you're using both a salt and an IV, is it OK? If so, where is the threshold when you stop using it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题最好在 crypto 上问,但无论如何我都会回答。
ECB 分组密码操作模式最适合用于随机数据,其中任何纯文本块之间都没有链接。实际上,只有随机密钥(没有任何附加/元数据)和随机挑战(在挑战响应协议中)符合该要求。数据应该是块大小的精确倍数,否则冲突仍然可能泄漏信息。使用特定的包装模式或提供语法 IV 的模式(SIV 模式)可以更好地保护密钥。
单块ECB与单块CBC相同,具有固定的IV。只要您不将密钥重复用于其他数据或消息,这对于消息来说就没有问题。使用密钥仅加密一个消息块是否有用当然是值得怀疑的。
大多数时候,只需使用 CBC 或更好的 GCM 验证加密即可。 ECB 通常存在,因为它可以在遗留应用程序中使用,非常容易提供,并且可以用作更安全模式或 MAC 构造的构建块。
This is better asked on crypto, but I'll answer anyway.
The ECB block cipher mode of operation is best used on randomized data, where there is no link between any of the plain text blocks. In practice, only randomized secret keys (without any additional / meta data) and random challenges (in challenge response protocols) fit that bill. The data should be a precise multiple of the block size, or collisions may still leak information. Secret keys are better protected using specific wrapping modes or modes that provide a syntactic IV (SIV modes).
Single block ECB is the same as single block CBC, with a fixed IV. It's fine for messages as long as you don't reuse the key for other data or messages. It is of course questionable if it is useful to encrypt just one message block with a key.
Most of the time it pays to simply go for CBC or, even better, GCM authenticated encryption. ECB is usually present as it may be used in legacy applications, is very easy to provide and can be used as a building block for more secure modes or MAC constructions.
是的
两个街区。使用 ECB 没有任何实际原因,它存在的唯一原因是它是如何使用分组密码的简单示例。
Yes
Two blocks. There isn't any practical reason to use ECB, the only reason it exists is because it's a simple example of how to use a block cipher.