タイプGetPassword
を返す関数があります。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);