public void RsaEncode(System.Numerics.BigInteger key, System.Numerics.BigInteger modulus) { var length = offset; offset = 0; var data = new byte[length]; GetBytes(data, 0, length); var biginteger2 = new System.Numerics.BigInteger(data); System.Numerics.BigInteger biginteger3 = biginteger2.modPow(key, modulus); byte[] @out = biginteger3.toByteArray(); offset = 0; WriteBytes(@out, 0, @out.Length); }