Porting Android to WP7. How do I handle KeyStore?
I'm porting an Android app to Windows Phone 7. The Android app uses a KeyStore. From what I read here, it looks like the equivalent in C# / .NET is X509CertificateStore. Ho开发者_如何学编程wever, the containing namespace doesn't appear to be part of Windows Phone 7. Is there an alternative specifically for WP7?
Edit: Looks like there is an X509Certificate class. I'm not familiar with certificates on either platform, but I'll give this a try. Any other suggestions is still greatly appreciated
According to MS documentation, this is not supported on WP7.
Unfortunately Key store as in Java or iOS is not possible on WP7. The X509Certificate can only be used to create new certificates, but not to read existing certificates on the phone. If you look it up on MSDN, you will notice that they are marked as security Critical. Security Critical Code cannot be invoked on regular locked devices.
However you can create a new X509Certificate from a bytestream, only thing is that you cannot add this certificate to the device certifacte store. That is only possible from email or webbrowser. There is also no way to look up what certificates are already installed on the phone (besides you unlock your phone and poke around registry and paths).
There is no place for protected secrets on WP7, like it is used in Androids KeyStore. You could only use IsolatedStorage with DPAPI like it is described here or encrypt files in IsolatedStorage with a password that is not safed somewhere on the phone.
精彩评论