public static string Encrypt(string text, string publicKey)
{
byte[] bytes = Encoding.ASCII.GetBytes(publicKey);
var cert = new X509Certificate2(bytes);
var rsa = cert.PublicKey.Key as RSACryptoServiceProvider;
var dataToEncrypt = ASCIIEncoding.ASCII.GetBytes(text);
var encryptedByteArray = rsa.Encrypt(dataToEncrypt, RSAEncryptionPadding.Pkcs1).ToArray();
return Convert.ToBase64String(encryptedByteArray);
}
using this code to encrypt the AADHAAR but not able to do that.
Please suggest me a code for C#