Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public static byte[] plainDecryptPub(byte[] data, RSAParameters key)
        {
            MyRSAParams myKey = MyRSAParams.fromRSAParameters(key);

            return(rsaOperation(data, myKey.pubExponent, myKey.Modulus));
        }