mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-01-18 19:51:24 +08:00
#433 address breaking change in aes api in net 6
https://github.com/dotnet/runtime/issues/55527
This commit is contained in:
@@ -23,7 +23,9 @@ namespace UglyToad.PdfPig.Tests.Encryption
|
|||||||
|
|
||||||
var output = AesEncryptionHelper.Decrypt(data, key);
|
var output = AesEncryptionHelper.Decrypt(data, key);
|
||||||
|
|
||||||
Assert.Equal("D:20180808103317-07'00'", OtherEncodings.BytesAsLatin1String(output));
|
var actual = OtherEncodings.BytesAsLatin1String(output);
|
||||||
|
|
||||||
|
Assert.Equal("D:20180808103317-07'00'", actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,16 +35,16 @@
|
|||||||
input.Seek(iv.Length, SeekOrigin.Begin);
|
input.Seek(iv.Length, SeekOrigin.Begin);
|
||||||
using (var cryptoStream = new CryptoStream(input, decryptor, CryptoStreamMode.Read))
|
using (var cryptoStream = new CryptoStream(input, decryptor, CryptoStreamMode.Read))
|
||||||
{
|
{
|
||||||
|
var offset = 0;
|
||||||
int read;
|
int read;
|
||||||
while ((read = cryptoStream.Read(buffer, 0, buffer.Length)) != -1)
|
do
|
||||||
{
|
{
|
||||||
output.Write(buffer, 0, read);
|
read = cryptoStream.Read(buffer, offset, buffer.Length - offset);
|
||||||
|
|
||||||
if (read < buffer.Length)
|
output.Write(buffer, offset, read);
|
||||||
{
|
|
||||||
break;
|
offset += read;
|
||||||
}
|
} while (read > 0);
|
||||||
}
|
|
||||||
|
|
||||||
return output.ToArray();
|
return output.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user