我应该在哪里存储加密记录的IVs ?

时间:2022-04-20 18:23:03

I'd like to encrypt some secret data before I store them in my database. RijndaelManaged seems a good option for this, but if I understand well, I need to generate a new IV for every single time when I encrypt something. So, where should I store these? Is it a good idea to concatenate the initialization vector and the encrypted value?

在我将一些秘密数据存储到我的数据库之前,我想对它们进行加密。RijndaelManaged看起来是一个不错的选择,但是如果我理解的很好,我需要在每次加密的时候生成一个新的IV。那么,我应该把这些放在哪里呢?将初始化向量和加密值连接起来是一个好主意吗?

1 个解决方案

#1


1  

The IV is not secret, you can store it anywhere you like. You can certainly store it in front of the ciphertext.

IV不是秘密,你可以把它储存在任何你喜欢的地方。你当然可以把它放在密文前面。

It is a good idea to have an IV, too, although it is optional in some cipher modes. I would use it whenever possible because it mitigates some attacks in certain situations. "Layman" cryptographers like us should play it very safe.

虽然在某些密码模式中它是可选的,但是最好也有一个IV。我将尽可能地使用它,因为它在某些情况下减轻了一些攻击。像我们这样的“外行”密码学家应该小心行事。

#1


1  

The IV is not secret, you can store it anywhere you like. You can certainly store it in front of the ciphertext.

IV不是秘密,你可以把它储存在任何你喜欢的地方。你当然可以把它放在密文前面。

It is a good idea to have an IV, too, although it is optional in some cipher modes. I would use it whenever possible because it mitigates some attacks in certain situations. "Layman" cryptographers like us should play it very safe.

虽然在某些密码模式中它是可选的,但是最好也有一个IV。我将尽可能地使用它,因为它在某些情况下减轻了一些攻击。像我们这样的“外行”密码学家应该小心行事。