示例#1
0
        public static byte[] Decrypt(byte[] target, string private_key)
        {
            var rsa = new RSACryptoServiceProvider(2048);

            RSAKeyExtensions.FromXmlString(rsa, private_key);
            return(rsa.Decrypt(target, false));
        }
示例#2
0
        /// <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);
        }