다음 Rijndael 코드를 사용하여 여러 번 암호화하지 않아도됩니다. 하지만 4.2GB로 ISO 파일을 암호화 할 수없는 이유는 무엇입니까? 실제로 내 컴퓨터는 16GB 메모리를 가지고 있으며 메모리 문제가되어서는 안됩니다. 나는 Windows 7 Ultimate를 사용합니다. 이 코드는 Visual Studio 2010 (VB.NET 프로젝트)을 사용하여 winform (.Net 4)으로 컴파일됩니다.Rijndael 암호화 코드가 대용량 파일에서 작동하지 않는 이유는 무엇입니까?
ISO 파일이 정상이며 가상 드라이브로 마운트 할 수 있으며 DVD 롬으로 구울 수 있음을 확인했습니다. 따라서 ISO 파일 문제는 아닙니다.
내 질문 : 다음 코드가 4.2GB 크기의 ISO 파일을 암호화 할 수없는 이유는 무엇입니까? Windows/.NET 4 구현의 한계로 인한 것입니까?
Private Sub DecryptData(inName As String, outName As String, rijnKey() As Byte, rijnIV() As Byte)
'Create the file streams to handle the input and output files.
Dim fin As New IO.FileStream(inName, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim fout As New IO.FileStream(outName, System.IO.FileMode.OpenOrCreate,
System.IO.FileAccess.Write)
fout.SetLength(0)
'Create variables to help with read and write.
Dim bin(100) As Byte 'This is intermediate storage for the encryption.
Dim rdlen As Long = 0 'This is the total number of bytes written.
Dim totlen As Long = fin.Length 'Total length of the input file.
Dim len As Integer 'This is the number of bytes to be written at a time.
'Creates the default implementation, which is RijndaelManaged.
Dim rijn As New Security.Cryptography.RijndaelManaged
Dim encStream As New Security.Cryptography.CryptoStream(fout,
rijn.CreateDecryptor(rijnKey, rijnIV), Security.Cryptography.CryptoStreamMode.Write)
'Read from the input file, then encrypt and write to the output file.
While rdlen < totlen
len = fin.Read(bin, 0, 100)
encStream.Write(bin, 0, len)
rdlen = Convert.ToInt32(rdlen + len)
End While
encStream.Close()
fout.Close()
fin.Close()
End Sub
당신이하려고 할 때 잘못 무엇? – AakashM
1GB + 암호화 된 파일을 생성 한 후 중지되었습니다. 하지만 내 소스 파일은 4GB 이상입니다. – user774411
참고로 버퍼 크기를 늘려야합니다. – Magnus