public static MyRSAParams fromRSAParameters(RSAParameters key) { var ret = new MyRSAParams(); ret.Modulus = new BigInteger(key.Modulus.Reverse().Concat(new byte[] { 0 }).ToArray()); ret.privExponent = new BigInteger(key.D.Reverse().Concat(new byte[] { 0 }).ToArray()); ret.pubExponent = new BigInteger(key.Exponent.Reverse().Concat(new byte[] { 0 }).ToArray()); return(ret); }
public static byte[] plainDecryptPub(byte[] data, RSAParameters key) { MyRSAParams myKey = MyRSAParams.fromRSAParameters(key); return(rsaOperation(data, myKey.pubExponent, myKey.Modulus)); }