public string RSAfirma(string datos) { BD dbUtiles = new BD(Formulario); string[] clavePrivada = dbUtiles.recuperaMisDatosPrivados().Split(','); Utiles utiles = new Utiles(); byte[] dataToSign = utiles.StrToByteArray(datos); RSAParameters Cprivada = new RSAParameters() {//modulo, exponente, claveprivadaD, DP, DQ, InverseQ, P, Q Modulus = Convert.FromBase64String(clavePrivada[0]), Exponent = Convert.FromBase64String(clavePrivada[1]), D = Convert.FromBase64String(clavePrivada[2]), DP = Convert.FromBase64String(clavePrivada[3]), DQ = Convert.FromBase64String(clavePrivada[4]), InverseQ = Convert.FromBase64String(clavePrivada[5]), P = Convert.FromBase64String(clavePrivada[6]), Q = Convert.FromBase64String(clavePrivada[7]) }; RSACryptoServiceProvider RSA2 = new RSACryptoServiceProvider(); RSA2.ImportParameters(Cprivada); byte[] signedData = RSA2.SignData(dataToSign, "SHA1"); return Convert.ToBase64String(signedData).ToString(); }