Ребята, я пытаюсь реализовать функцию PBKDF2 в С#, которая создает WPA Shared key. Я нашел здесь: http://msdn.microsoft.com/en-us/magazine/cc163913.aspx, который, похоже, приводит к допустимому результату, но это один байт слишком короткий... и неправильный PSK значение.
Чтобы проверить результат, я сравниваю его с этим: http://www.xs4all.nl/~rjoris/wpapsk.html или http://anandam.name/pbkdf2/
Я нашел один способ заставить это работать со встроенной библиотекой на С# под названием Rfc2898DeriveBytes. Используя это, я получаю действительный вывод, используя:
Rfc2898DeriveBytes k3 = new Rfc2898DeriveBytes(pwd1, salt1, 4096);
byte[] answers = k3.GetBytes(32);
Теперь одно ограничение, которое я использую Rfc2898DeriveBytes, - это "соль", длина которого должна быть 8 октетов. Если он короче, Rfc2898DeriveBytes генерирует исключение. Я думал, что все, что мне нужно было сделать, это проложить соль (если бы она была короче) до 8 байт, и я был бы хорош. Но нет! Я пробовал почти все комбинации дополнений с более короткой солью, но я не могу дублировать результаты, полученные с этих двух сайтов выше.
Итак, нижняя строка означает, означает ли это, что Rfc2898DeriveBytes просто не будет работать с источником соли короче 8 байтов? Если да, то кто-нибудь знает какой-либо код С#, который я мог бы использовать, который реализует PBKDF2 для WPA Preshared key?