Ejemplo n.º 1
0
        public byte[] Encrypt(byte[] buf, int length)
        {
            lock (encryptLockObj)
            {
                if (dispose)
                {
                    throw new Exception("encryptCTX has been Dispose");
                }
                switch (method)
                {
                case "table":
                    for (int i = 0; i < length; i++)
                    {
                        buf[i] = encryptTable[buf[i]];
                    }
                    return(byteArrayWith(buf, length));

                case "rc4":
                    rc4.Encrypt(encryptTable, buf, length);
                    return(byteArrayWith(buf, length));

                default:
                    return(sslEncrypt(buf, length));
                }
            }
        }
Ejemplo n.º 2
0
        public void Encrypt(byte[] buf, int length)
        {
            switch (method)
            {
            case TYPE_TABLE:
                for (int i = 0; i < length; i++)
                {
                    buf[i] = encryptTable[buf[i]];
                }
                break;

            case TYPE_RC4:
                rc4.Encrypt(encryptTable, buf, length);
                break;
            }
        }
Ejemplo n.º 3
0
        public byte[] Encrypt(byte[] buf, int length)
        {
            lock (LockObj)
            {
                switch (method)
                {
                case "table":
                    for (int i = 0; i < length; i++)
                    {
                        buf[i] = encryptTable[buf[i]];
                    }
                    return(byteArrayWith(buf, length));

                case "rc4":
                    rc4.Encrypt(encryptTable, buf, length);
                    return(byteArrayWith(buf, length));

                default:
                    return(sslEncrypt(buf, length));
                }
            }
        }