using System.Security.Cryptography;
using Aes aes = Aes.Create();
aes.IV = Encoding.ASCII.GetBytes("asdfghjklqwertyu");
aes.Key = Encoding.ASCII.GetBytes("abcdefhhijklmnop");
Trong đó IV và Key số lượng là 16 bytes
byte[] cipher = aes.EncryptCbc(Encoding.UTF8.GetBytes("ceb.net.vn"), aes.IV);
byte[] bytes = aes.DecryptCbc(cipher, aes.IV);
string text = Encoding.UTF8.GetString(bytes));
RSA rsa = RSA.Create();
string publicKey = rsa.ToXmlString(false);
string privateKey = rsa.ToXmlString(true);
byte[] cipher = rsa.Encrypt(Encoding.UTF8.GetBytes("ceb.net.vn"), RSAEncryptionPadding.Pkcs1);
byte[] bytes = rsa.Decrypt(cipher, RSAEncryptionPadding.Pkcs1);
string text = Encoding.UTF8.GetString(bytes);