fix implementation of yubikey secret reading
This commit is contained in:
@@ -148,17 +148,13 @@ namespace KeeChallenge
|
|||||||
{
|
{
|
||||||
//read the secret from the stream
|
//read the secret from the stream
|
||||||
int totalBytesRead = 0;
|
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)
|
while (bytesRead > 0 && totalBytesRead < secret.Length)
|
||||||
{
|
{
|
||||||
secretOutputStream.Write(buffer, 0, bytesRead);
|
|
||||||
totalBytesRead += bytesRead;
|
totalBytesRead += bytesRead;
|
||||||
bytesRead = csDecrypt.Read(buffer, totalBytesRead, secret.Length - totalBytesRead);
|
bytesRead = csDecrypt.Read(secret, totalBytesRead, secret.Length - totalBytesRead);
|
||||||
}
|
}
|
||||||
secretOutputStream.Close();
|
|
||||||
|
|
||||||
csDecrypt.Close();
|
csDecrypt.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user