Note that there are some explanatory texts on larger screens.

plurals
  1. POPBKDF2 implementation in C# with Rfc2898DeriveBytes
    primarykey
    data
    text
    <p>Guys, I'm trying to implement a PBKDF2 function in C# that creates a WPA Shared key. I've found some here: <a href="http://msdn.microsoft.com/en-us/magazine/cc163913.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163913.aspx</a> that seems to produce a valid result, but it's one byte too short... and the wrong PSK value.</p> <p>To test the output, I am comparing it to this: <a href="http://www.xs4all.nl/~rjoris/wpapsk.html" rel="noreferrer">http://www.xs4all.nl/~rjoris/wpapsk.html</a> or <a href="http://anandam.name/pbkdf2/" rel="noreferrer">http://anandam.name/pbkdf2/</a></p> <p>I did find one way of getting this to work with a built in library to C# called Rfc2898DeriveBytes. Using this, I get a valid output using:</p> <pre><code>Rfc2898DeriveBytes k3 = new Rfc2898DeriveBytes(pwd1, salt1, 4096); byte[] answers = k3.GetBytes(32); </code></pre> <p>Now, the one limitation I have using Rfc2898DeriveBytes is the "salt" must be 8 octets long. If it is shorter, the Rfc2898DeriveBytes throws an exception. I was thinking all I had to do was pad the salt (if it was shorter) to 8 bytes, and I'd be good. But NO! I've tried pretty much every combination of padding with a shorter salt, but I cannot duplicate the results I get from those two websites above.</p> <p>So bottom line is, does this mean the Rfc2898DeriveBytes just simply won't work with a source salt shorter than 8 bytes? If so, does anyone know of any C# code I could use that implements PBKDF2 for WPA Preshared key?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload