RSA encryption in iPhone using .NET generated public key?
How can i encrypt dat开发者_StackOverflow中文版a using RSA encryption in iOS?. I want to encrypt using public key that is send from .NET. is it possible?. How can i send public key from .NET webservice?.
Thanks in Advance, Sanal
How can i encrypt data using RSA encryption in iOS?
Several choice. If you use C or ObjectiveC then the easiest way is to use CommonCrypto.
You can also use C# and the .NET framework on your iOS devices with MonoTouch (disclaimer, I work for Xamarin) and share code between your web service and device.
I want to encrypt using public key that is send from .NET. is it possible?
Yes. You generally encrypt the (potentially large) using a symmetric key (e.g. AES) then encrypt the symmetric (secret) key using the public key. See my old blog entry for more details.
How can i send public key from .NET webservice?
You can send it as XML, call rsa.ToXmlString () to get the public key in the xmldsig-defined format.
Note that it's unclear, from your previous answer, if the web services encrypts (and the iOS client decrypts) or the other way around (could be both too). You'll want to take care where the private key is generated and how the keys are transfered between the service and device (e.g. using https).
精彩评论