public static byte[] Decrypt(byte[] target, string private_key) { var rsa = new RSACryptoServiceProvider(2048); RSAKeyExtensions.FromXmlString(rsa, private_key); return(rsa.Decrypt(target, false)); }
/// <summary> /// Create new private key, pulibc key pair. /// </summary> /// <returns></returns> public static (string, string) CreateKey() { var rsa = new RSACryptoServiceProvider(2048); var private_key = RSAKeyExtensions.ToXmlString(rsa, true); var public_key = RSAKeyExtensions.ToXmlString(rsa, false); return(private_key, public_key); }