public static RSAParameters ToRSAParameters(RsaPrivateKeyStructure privKey)
 {
     RSAParameters rp = new RSAParameters();
     rp.Modulus = privKey.Modulus.ToByteArrayUnsigned();
     rp.Exponent = privKey.PublicExponent.ToByteArrayUnsigned();
     rp.P = privKey.Prime1.ToByteArrayUnsigned();
     rp.Q = privKey.Prime2.ToByteArrayUnsigned();
     rp.D = ConvertRSAParametersField(privKey.PrivateExponent, rp.Modulus.Length);
     rp.DP = ConvertRSAParametersField(privKey.Exponent1, rp.P.Length);
     rp.DQ = ConvertRSAParametersField(privKey.Exponent2, rp.Q.Length);
     rp.InverseQ = ConvertRSAParametersField(privKey.Coefficient, rp.Q.Length);
     return rp;
 }
 public static RSA ToRSA(RsaPrivateKeyStructure privKey)
 {
     return CreateRSAProvider(ToRSAParameters(privKey));
 }