private async Task <byte[]> InternalDecryptCbcAsync(byte[] input, byte[] key)
        {
            var iv = new byte[IvSize];
            var encryptedContent = new byte[input.Length - IvSize];

            Buffer.BlockCopy(input, 0, iv, 0, iv.Length);
            Buffer.BlockCopy(input, iv.Length, encryptedContent, 0, encryptedContent.Length);
            using (var ms = new MemoryStream())
            {
                using (var blowfish = new BlowfishCbc(key, iv, false))
                {
                    using (var cs = new CryptoStream(ms, blowfish, CryptoStreamMode.Write))
                    {
                        await cs.WriteAsync(encryptedContent, 0, encryptedContent.Length);
                    }
                }
                return(ms.ToArray());
            }
        }
        private async Task <byte[]> InternalEncryptCbcAsync(byte[] input, byte[] key)
        {
            byte[] iv = null;
            byte[] encryptedContent = null;
            using (var ms = new MemoryStream())
            {
                iv = GetIv();
                using (var blowfish = new BlowfishCbc(key, iv, true))
                {
                    using (var cs = new CryptoStream(ms, blowfish, CryptoStreamMode.Write))
                    {
                        await cs.WriteAsync(input, 0, input.Length);
                    }
                }
                encryptedContent = ms.ToArray();
            }
            //Create new byte array that should contain both unencrypted iv and encrypted data
            var result = iv.Combine(encryptedContent);

            return(result);
        }