Skip to content

Are YubiKey's HMAC-SHA1 responses actually 20 bytes, or are they truncated? #11608

Closed Answered by droidmonkey
danimoh asked this question in Q&A
Discussion options

You must be logged in to vote

Yes it is actually 20 bytes, see the Yubikey code here:

int yk_challenge_response(YK_KEY *yk, uint8_t yk_cmd, int may_block,
unsigned int challenge_len, const unsigned char *challenge,
unsigned int response_len, unsigned char *response)
{
unsigned int flags = 0;
unsigned int bytes_read = 0;
unsigned int expect_bytes = 0;
switch(yk_cmd) {
case SLOT_CHAL_HMAC1:
case SLOT_CHAL_HMAC2:
expect_bytes = 20;
break;
case SLOT_CHAL_OTP1:
case SLOT_CHAL_OTP2:
expect_bytes = 16;
break;
default:
yk_errno = YK_EINVALIDCMD;
return 0;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danimoh
Comment options

Answer selected by danimoh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #11607 on December 29, 2024 01:38.