Asymmetrically Encrypt Data
Problem
You need to encrypt data in situations in which there is no shared secret key.
Solution
Use asymmetric encryption with the RSACryptoServiceProvider class.
Discussion
Asymmetric encryption allows you to exchange encrypted data between two parties without requiring a shared secret value. Asymmetric encryption introduces the concept of key pairs. The basic concept is that every user has both a private and a public key. Information encrypted with the public key can be decrypted only with the private key. The public key is made available to the whole world and can be transmitted freely over unsecured connections such as the Internet. The private key is carefully guarded. Thus, any user can make use of another user’s public ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.