私はSecureString
タイプを返す関数GetPassword
をしました。Rfc2898DeriveBytes + PBKDF2 + SecureStringは文字列の代わりに安全な文字列を使用できますか?
私は鍵を生成するためにRfc2898DeriveBytes
に、このセキュリティで保護された文字列を渡すと、Visual Studioがエラーを示しています。私の限られた知識は、Rfc2898DeriveBytes
は文字列だけを受け入れ、安全な文字列を受け入れないからです。これには回避策がありますか?
//read the password from terminal
Console.Write("Insert password");
securePwd = myCryptography.GetPassword();
//dont know why the salt is initialized like this
byte[] salt = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xF1, 0xF0, 0xEE, 0x21, 0x22, 0x45 };
try
{ //PBKDF2 standard
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(securePwd, salt, iterationsPwd);
...塩がそうである理由はわかりません:D – NoobTom
私は今、私がsecurePwd.ToStringを使用しているということは、secureStringを無用に使用するというプロセス全体が問題になることです。 D – NoobTom
これは、 '/ /端末からのパスワードの読み込み 'で始まります。 –