How one would encrypt a string using asymmetric encryption on WinRT Metro in C# and decrypt this in classic Windows, let’s say in a webservice?
I want to use RsaPkcs1 algorithm and I can see that CryptographicKey class and RSAParameters class are not even near compatible.
How this could be accomplished?
I have found the solution on how to export the keys from the
CryptographicKeyin a format that .net 4 can successfully use.CryptographicKeyhas 2 functions 1.Exportand 2.ExportPublicKey. I used the 1st function that exports the private key. This function has 2 parameters 1st is the type of export and 2nd the byte[] that will fill.If
CryptographicPrivateKeyBlobType.Capi1PrivateKeyis used, the blob thatExportwill produce is compatible with the WinCAPI thatRSACryptoServiceProviderof .net 4 can import.WinRT
encryptedBase64Strnow contains the encrypted string in Base64. And lets say thatencryptedBase64Str="BwIAAACkAABSU0EyAAIAAAEAAQCFrMTqMU3T14zSUM5..."Web Service
decryptedStringnow contains the decrypted string that WinRT had.