System.Security.Cryptography.RC2CryptoServiceProvider.CreateEncryptor C# (CSharp) Method

CreateEncryptor() private method

private CreateEncryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform
rgbKey byte
rgbIV byte
return ICryptoTransform
        public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
        {
            return CreateTransform(rgbKey, rgbIV == null ? null : rgbIV.CloneByteArray(), encrypting: true);
        }

Usage Example

        public string mEncryptURLEncode(string text)
        {
            byte[] plainBytes = Encoding.Unicode.GetBytes(text);
            byte[] cipherBytes;

            using (ICryptoTransform sse = rc2.CreateEncryptor())
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (CryptoStream cs = new CryptoStream(ms, sse, CryptoStreamMode.Write))
                    {
                        cs.Write(plainBytes, 0, plainBytes.Length);
                        cs.FlushFinalBlock();
                        cs.Close();
                        cs.Dispose();
                    }
                    cipherBytes = ms.ToArray();
                    ms.Close();
                    ms.Dispose();
                }
                sse.Dispose();
            }

            string sEncrypt = Convert.ToBase64String(cipherBytes, 0, cipherBytes.Length);

            return(HttpUtility.UrlEncode(sEncrypt));
        }
All Usage Examples Of System.Security.Cryptography.RC2CryptoServiceProvider::CreateEncryptor