Quote from: JMcSub-PKYubikey.exe will not compile and run properly for me (I think...). When I attempt to open the program, the command prop window flashes open and then quickly closes. Is this normal.This is normal with console applications. You need to open command prompt and run the application from there to see the messages.
QuoteHowever, I was able to resolve the issue stated in the previous messages by reading through the example source code. I was not calling the PKYubikeyRegisterOTPhex function, but simply calling the PKYubikeyRegisterOTP function directly. So thank you for steering me in the right direction!Glad it is resolved.
QuoteI investigated further and found out that my OTP does not equal the constant YUBIKEY_CRC_OK_RESIDUE ($f0b8) when run through the YubikeyCRC16 function. Is this an error in the way I am formatting the Yubikey within the Yubikey configuration tool?The CRC should always match YUBIKEY_CRC_OK_RESIDUE, provided that the content of the message was decrypted successfully. So it is likely that the token was not decrypted successfully, and that almost certainly means there is a mismatch between the AES key of your token and AES key registered by PKYubikeyRegisterOTP. Please run RegEdit and open key HKEY_LOCAL_MACHINE\SOFTWARE\Pepak\Yubikey. Here you will find subkeys for your registered users. Make sure the Key value matches your AES key.
QuoteI have tried formatting the Yubikey with a public ID, a private ID, and without any ID (obviously, I am using the 'Dynamic Yubikey Configuration' setting.) Are these settings incorrect for this particular library? What settings do you usually use?- Public ID is ignored by the library. Just to be sure, configure your Youbikey not to use it at all for now. Once we get the library to work for you, we can turn it back on.
procedure TForm1.SubmitbtnClick(Sender: TObject);
var
Name: PChar;
UID: PYubikeyUID;
Key: PYubikeyKey;
OtpCounter: LongInt;
i: integer;
This: packed array of byte;
Whatever: packed array of byte;
begin
SetLength(This, Length(UserIDEdit.Text));
for i := 0 to Length(UserIDEdit.Text) - 1 do
This[i] := ord(UserIDEdit.Text[i + 1]);
SetLength(Whatever, Length(UserIDEdit.Text));
for i := 0 to Length(KeyEdit.Text) - 1 do
Whatever[i] := ord(KeyEdit.Text[i + 1]);
Name := PChar(NameEdit.Text);
UID := PYubikeyUID(This);
Key := PYubikeyKey(Whatever);
OtpCounter := -1;
PKYubikeyRegisterOTP(Name, UID, Key, OtpCounter);
end;
[b]procedure[/b] TForm1.SubmitbtnClick(Sender: TObject);
[b]var[/b]
Name: PChar;
UID: PYubikeyUID;
Key: PYubikeyKey;
OtpCounter: LongInt;
i: integer;
This: packed array of byte;
Whatever: packed array of byte;
[/b]begin[b]
SetLength(This, Length(UserIDEdit.Text));
[b]for[/b] i := 0 to Length(UserIDEdit.Text) - 1 [b]do[/b]
This[i] := ord(UserIDEdit.Text[i + 1]);
SetLength(Whatever, Length(UserIDEdit.Text));
[b]for[/b] i := 0 to Length(KeyEdit.Text) - 1 [b]do[/b]
Whatever[i] := ord(KeyEdit.Text[i + 1]);
Name := PChar(NameEdit.Text);
UID := PYubikeyUID(This);
Key := PYubikeyKey(Whatever);
OtpCounter := -1;
PKYubikeyRegisterOTP(Name, UID, Key, OtpCounter);
[b]end;[/b]