public static RSAKey CreateRsaKey(System.Security.Cryptography.RSA rsa)
        {
            Check.Argument.IsNotNull(rsa, nameof(rsa));

            string publicKey  = rsa.ToJsonString(false);
            string privateKey = rsa.ToJsonString(true);

            return(new RSAKey()
            {
                PublicKey = publicKey,
                PrivateKey = privateKey,
                Exponent = rsa.ExportParameters(false).Exponent.ToHexString(),
                Modulus = rsa.ExportParameters(false).Modulus.ToHexString()
            });
        }
        public static RSAKey CreateRsaKey(RsaSize rsaSize = RsaSize.R2048)
        {
            using (System.Security.Cryptography.RSA rsa = System.Security.Cryptography.RSA.Create())
            {
                rsa.KeySize = (int)rsaSize;



                string publicKey  = rsa.ToJsonString(false);
                string privateKey = rsa.ToJsonString(true);

                return(new RSAKey()
                {
                    PublicKey = publicKey,
                    PrivateKey = privateKey,
                    Exponent = rsa.ExportParameters(false).Exponent.ToHexString(),
                    Modulus = rsa.ExportParameters(false).Modulus.ToHexString()
                });
            }
        }