Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

When I configure a Yubikey slot as static, it's not documented or obvious how the static password yielded by a press relates to the AES key I set. For example:

me@mine:~$ ykpersonalize -1 -ostatic-ticket -ofixed=cccccccccccc -a00000000000000000000000000000000             
Firmware version 2.3.3 Touch level 1795 Program sequence 9

Configuration data to be written to key configuration 1:

fixed: m:cccccccccccc
uid: 000000000000
key: h:00000000000000000000000000000000
acc_code: h:000000000000
ticket_flags: APPEND_CR
config_flags: STATIC_TICKET
extended_flags: 

Commit? (y/n) [n]: y

me@mine:~$ cat >/dev/null  # and do a short press...
ccccccccccccncejelrjvjvvciclerknrlihnteljrcb

Where does the key-based part (ncejelrjvjvvciclerknrlihnteljrcb) come from?

share|improve this question
add comment

1 Answer 1

The password is the result of encrypting the fields used for OTP, but with fixed values:

me@mine:~$ ykparse 00000000000000000000000000000000 ncejelrjvjvvciclerknrlihnteljrcb
Input:
  token: ncejelrjvjvvciclerknrlihnteljrcb
          b0 38 3a c8 f8 ff 07 0a 3c 9b ca 76 bd 3a 8c 01 
  aeskey: 00000000000000000000000000000000
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Output:
          00 00 00 00 00 00 ff ff ff ff ff ff ff ff 0f 2e 

Struct:
  uid: 00 00 00 00 00 00 
  counter: 65535 (0xffff)
  timestamp (low): 65535 (0xffff)
  timestamp (high): 255 (0xff)
  session use: 255 (0xff)
  random: 65535 (0xffff)
  crc: 11791 (0x2e0f)

Derived:
  cleaned counter: 32767 (0x7fff)
  modhex uid: cccccccccccc
  triggered by caps lock: yes
  crc: F0B8
  crc check: ok

This can be reproduced with OpenSSL:

me@mine:~$ key=00000000000000000000000000000000
me@mine:~$ fixed='\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x0f\x2e'
me@mine:~$ modhex -h $(echo -ne "$fixed" | openssl enc -aes128 -nopad -K $key -iv "" \
                       | hexdump -v -e '/1 "%02x"')
ncejelrjvjvvciclerknrlihnteljrcb

You can't quite reproduce it with ykgenerate because that tool always includes a genuinely unpredictable random: field.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.