Generate Keys Takes Inordinate Amount of Time WP7

Jul 29, 2011 at 2:48 AM

This is my first experience using this library, prior I was going to do the implementation myself.  I attempt to let Scrypt generate a public/private key pair with the smallest key size 256 but it seems like it's churning but to no end.  I've have a delegate set for the OnKeysGenerated event and a break point in the method but it never hits it.  I'm using the WP7 7.1 beta 2 tools on a 64-bit windows ultimate install with a Intel Q6600 w/ 8GB of Ram.  I originally tried a 2048 key size but experienced the same thing so I lowered it.  Any help would be appreciated.

Jul 29, 2011 at 3:53 PM

Let me take a look.  My guess is that an exception is being thrown in one of the threads that are generating the large prime numbers for the keys and not making it back up to the parent thread.  Have you tried downloading the source and recompiling for your target WP7 version?

Jul 29, 2011 at 4:05 PM

I haven't but I can when I get a chance.

Jul 29, 2011 at 4:21 PM

I think I've figured it out, user error.  Because keys must be generated before Encryption/Decryption and the GenerateKeys method is Asynchronous, I was attempting to use signalling between threads to block while the keys were being generated.  The problem here is that I was blocking the UI thread, which means everything was blocked.  By removing the use of ManualResetEvent, and instead adding an event I'm able to get keys generated.

Jul 29, 2011 at 6:16 PM

Great.  Let me know if you still have an issue.  I'm also running WP7 7.1 beta 2 tools and can test on my end if needed.  If you do run into issues, are you able to test it on the phone and not just the emulator?

Jul 29, 2011 at 6:18 PM

Unfortunately I do not have a phone.  I'm waiting for the fall when something decent, hopefully, comes out for Verizon.  I'm not a fan of the Trophy.

Jul 29, 2011 at 7:57 PM

BTW when I tried to open the sln from the latest source it wanted me to login via TFS.  Is there a way to get the source without needing to login?  If not what is the process?  I can start a new discussion if that's more appropriate.

Jul 30, 2011 at 6:33 PM

Just cancel when it asks you to login and it will ask you to open the solution offline.  You're not required to login to open it.  You can also unbind your local version from source control.