简体   繁体   中英

How to Encrypt string in WinRT app, decrypt in WCF service?

I'm wondering how to encrypt a string in my Windows 8 app, and then how to decrypt it in a WCF service. I want to do this for security reasons. I'm new to encryption and it's very confusing for me. I do know, (correct me if I'm wrong) that hashing algorithm's like MD5 and SHA1 cannot be reversed to get the original value of a string. So if I were to use one of those algorithms, then how can I get the original value in my web service?

Also, if you can give me any resources on encryption and other related subjects, then that'd be awesome. Thank you for you time!

If you want to prevent eavesdropping on the communication between your app and the service, I would suggest you to just use SSL/TLS ( https ) as it was designed to do exactly that.

If for some reason you really want/need to encrpt a string before sending it across the wire, asymetric encryption (RSA) would be your best choice. You can look at this SO answer for details on that, including the export/import of the key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM