如何解码巨大的base64字符串

时间:2018-12-09 18:07:56

标签: c# arrays encoding base64 converters

我正在寻找一种无需获取OutOfMemoryException即可从文件中解码很大(1.5Gb)base64字符串的方法。我尝试使用this方法进行编码。 你能建议我一种方法吗?

提前谢谢!

编辑:

密码:

 public static string HighLevelEncryptionAES(byte[] plainDataBytes, byte[] keyBytes)
        {
            CryptoSecurityClass cryptoSecurity = new CryptoSecurityClass();
            AesCryptoServiceProvider serviceProvider = cryptoSecurity.GetAesProvider(keyBytes);

            ICryptoTransform encryptor = serviceProvider.CreateEncryptor();

            byte[] encryptedBytes = encryptor.TransformFinalBlock(plainDataBytes, 0, plainDataBytes.Length);

            string encryptedString = Convert.ToBase64String(encryptedBytes);

            return encryptedString;
        }

AES提供程序类:

    private AesCryptoServiceProvider GetAesProvider(byte[] key)
            {
                return new AesCryptoServiceProvider()
                {
                    KeySize = 256,
                    Key = key,
                    BlockSize = 128,
                    Padding = PaddingMode.PKCS7,
                    Mode = CipherMode.ECB
                };
}

0 个答案:

没有答案