Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

Commit

Permalink
Finishing touches on ES for PIN/PUK sets
Browse files Browse the repository at this point in the history
Related #25
  • Loading branch information
mike-csis committed May 10, 2017
1 parent b1f676f commit 0aed5ad
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
14 changes: 7 additions & 7 deletions EnrollmentStation/DlgSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions EnrollmentStation/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.5.0")]
[assembly: AssemblyFileVersion("0.3.5.0")]
[assembly: AssemblyVersion("0.3.5.1")]
[assembly: AssemblyFileVersion("0.3.5.1")]
54 changes: 40 additions & 14 deletions YubicoLib/YubikeyPiv/YubikeyPivDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,31 @@ private static int GetDataOffsetAndLength(byte[] data, out int dataLength)
public void BlockPin()
{
string randomPin = "PASSWORD";

// Note: A flaw in the Yubikey means that it will return remaining tries in "groups" of 16. For this reason, we need to block the PIN one more time to see if we still can do it.
// Example: Tries is 17. On the first failed attempt, the Yubikey will return 0 tries remaining ("blocked"), but a second attempt will return 15 tries remaining.

int tmpRemaining;
int attempts;
do
{
bool success = VerifyPin(randomPin, out tmpRemaining);
attempts = 0;

if (success)
int tmpRemaining;
do
{
// Wow, someone had PASSWORD as their PIN. Alter our test.
randomPin = "DROWSSAP";
}
} while (tmpRemaining > 0);
bool success = VerifyPin(randomPin, out tmpRemaining);

if (success)
{
// Wow, someone had PASSWORD as their PIN. Alter our test.
randomPin = "DROWSSAP";
}

if (tmpRemaining > 0)
attempts++;

} while (tmpRemaining > 0);
} while (attempts > 0);
}

public bool UnblockPin(string puk, string newPin)
Expand All @@ -466,17 +479,30 @@ public void BlockPuk()
{
string randomPin = "PASSWORD";

int tmpRemaining;
// Note: A flaw in the Yubikey means that it will return remaining tries in "groups" of 16. For this reason, we need to block the PUK one more time to see if we still can do it.
// Example: Tries is 17. On the first failed attempt, the Yubikey will return 0 tries remaining ("blocked"), but a second attempt will return 15 tries remaining.

int attempts;
do
{
bool success = ChangePuk(randomPin, randomPin, out tmpRemaining);
attempts = 0;

if (success)
int tmpRemaining;
do
{
// Wow, someone had PASSWORD as their PUK. Alter our test.
randomPin = "DROWSSAP";
}
} while (tmpRemaining > 0);
bool success = ChangePuk(randomPin, randomPin, out tmpRemaining);

if (success)
{
// Wow, someone had PASSWORD as their PUK. Alter our test.
randomPin = "DROWSSAP";
}

if (tmpRemaining > 0)
attempts++;

} while (tmpRemaining > 0);
} while (attempts > 0);
}
}
}

0 comments on commit 0aed5ad

Please sign in to comment.