我正在使用 .net System.Security 中的 Rijndael 类来加密我的 RSA 密钥
这就是我的设置方式:
static Rijndael CreateRijndael (byte[] userID, string password, string pepper)
{
if (userID == null)
throw new ArgumentNullException ("userID");
if (password == null)
throw new ArgumentNullException ("password");
if (pepper == null)
throw new ArgumentNullException ("pepper");
string passpepper = password + pepper;
Rijndael Rij = Rijndael.Create ();
Rij.KeySize = 256;
Rij.Padding = PaddingMode.ISO10126;
Rij.Mode = CipherMode.CBC;
Rfc2898DeriveBytes aesKey = new Rfc2898DeriveBytes (passpepper, userID, 65536);
Rij.Key = aesKey.GetBytes (Rij.KeySize / 8);
Rij.GenerateIV ();
return Rij;
}
这就是我得到的:
逫⇾귏䜪춈票칔alue><Modulus>kgOu5EG6vbabnvq6xB+cRmxDL....
代替
<RSAKeyValue><Modulus>kgOu5EG6vbabnvq6xB+cRmxDL...
是IV吗?
如果是 IV,考虑到我已将模式设置为 CBC,它不应该混淆整个文本吗?