Merge pull request #2845 from PhilippC/2816-bug-yubikey-not-working-in-112

fix implementation of yubikey secret reading
This commit is contained in:
PhilippC
2025-04-15 13:18:25 +02:00
committed by GitHub

View File

@@ -148,17 +148,13 @@ namespace KeeChallenge
{
//read the secret from the stream
int totalBytesRead = 0;
byte[] buffer = new byte[secret.Length];
var secretOutputStream = new MemoryStream(secret);
int bytesRead = csDecrypt.Read(buffer, totalBytesRead, secret.Length - totalBytesRead);
int bytesRead = csDecrypt.Read(secret, totalBytesRead, secret.Length - totalBytesRead);
while (bytesRead > 0 && totalBytesRead < secret.Length)
{
secretOutputStream.Write(buffer, 0, bytesRead);
totalBytesRead += bytesRead;
bytesRead = csDecrypt.Read(buffer, totalBytesRead, secret.Length - totalBytesRead);
bytesRead = csDecrypt.Read(secret, totalBytesRead, secret.Length - totalBytesRead);
}
secretOutputStream.Close();
csDecrypt.Close();
}