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

CreateEncryptor() private method

private CreateEncryptor ( ) : ICryptoTransform
return ICryptoTransform
        public override ICryptoTransform CreateEncryptor()
        {
            return CreateTransform(Key, IV, encrypting: true);
        }

Same methods

DESCryptoServiceProvider::CreateEncryptor ( byte rgbKey, byte rgbIV ) : ICryptoTransform

Usage Example

Beispiel #1
1
        public static string Encrypt( string strEncryptString, string strEncryptionKey)
        {
            byte[] inputByteArray;

            try
            {
                key = Encoding.UTF8.GetBytes(strEncryptionKey.Substring(0, 8));

                DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                inputByteArray = Encoding.UTF8.GetBytes(strEncryptString);

                MemoryStream ms = new MemoryStream();
                CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(key, IV), CryptoStreamMode.Write);

                cs.Write(inputByteArray, 0, inputByteArray.Length);
                cs.FlushFinalBlock();

                return Convert.ToBase64String(ms.ToArray());
            }
            catch (Exception eX)
            {

                throw eX;
            }
        }
All Usage Examples Of System.Security.Cryptography.DESCryptoServiceProvider::CreateEncryptor