Net Encryption Library
RSA Encrypt Strings
Basic Tasks > RSA Encrypt Strings

RSA Encrypt Strings Overview

RSA uses a concept of a public key and a private key.  Information is encrypted using the public key and then decrypted with the private key.

https://en.wikipedia.org/wiki/RSA_(cryptosystem)

 

Encryption encryption = new Encryption(); //Trial Mode

//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode

 

string unencryptedString = "This is a test";

Console.WriteLine("UnEncrypted String");

Console.WriteLine(unencryptedString);

 

AsymmetricKeyPair keys = encryption.GenerateRSAKeys();

 

string encryptedString = encryption.EncryptString(EncryptionProvider.RSA, keys.PublicKeyOnly, unencryptedString);

Console.WriteLine("Encrypted String");

Console.WriteLine(encryptedString);

 

string decryptedString = encryption.DecryptString(EncryptionProvider.RSA, keys.PublicPrivateKeyPair, encryptedString);

Console.WriteLine("Decrypted String");

Console.WriteLine(decryptedString);