Yubico Forum
https://forum.yubico.com/

Cannot verify pin using libykpiv-1.dll with ykPIV_verify
https://forum.yubico.com/viewtopic.php?f=22&t=2570
Page 1 of 1

Author:  mcdown75 [ Wed Feb 15, 2017 7:46 pm ]
Post subject:  Cannot verify pin using libykpiv-1.dll with ykPIV_verify

I am working to develop a limited pin change and pin reset tool that we can distribute organization wide. We only want to allow them to change their pin or reset it. If anyone knows where documentation on this dll, or the libyubikey-0.dll I would really appreciate a link to it.


I have completed the reset process using references to libykpiv-1.dll. I cannot get the ykPIV_verify to work properly. I believe the byte that I am passing containing the current pin is not formatted correctly. I am using the following code:

public bool VerifyPin(string CurrPin, out int triesLeft)
{
try
{
byte[] bytePin = Encoding.ASCII.GetBytes(CurrPin);
triesLeft = 0;
YubicoPivReturnCode code = SafeNativeMethods.YkPivVerifyPin(_state, bytePin, ref triesLeft);
if (code != YubicoPivReturnCode.YKPIV_OK)
{
return false;
}
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
triesLeft = 0;
return false;
}

}


Can anyone help me out with this?

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/