Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding behaviour for 64 byte challenges #4

Open
StarGate01 opened this issue Jul 23, 2021 · 1 comment
Open

Padding behaviour for 64 byte challenges #4

StarGate01 opened this issue Jul 23, 2021 · 1 comment

Comments

@StarGate01
Copy link

The genuine Yubikey seems to implement a particular behavior when the challenge is exactly 64 bytes long.
In that case, the last byte is considered padding and ignored, and so are all bytes of the same value preceding it.

This applet always considers the full challenge as data and is thus not compatible with systems that expect a Yubikey and issue a 64 byte challenge.

If you want to test this for yourself, I have attached two bash scripts that use ykchalresp for a USB Yubikey and yktool for a Javacard running this applet or a NFC Yubikey. padding.zip

I will try to fix this issue in a fork and make a PR eventually.

@StarGate01
Copy link
Author

I considered that this padding might be PKCS#7, but the challenges [.. 60 bytes ..] 01 01 01 01, [.. same 60 bytes ..] 02 02 02 02 and [.. same 60 bytes ..] produce the same response, indicating that the actual value of the padding bytes is ignored and the last byte is always used as a template. I guess the host application has to worry that the last actual data byte is different from the bytes used for padding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant