YKPERSONALIZE(1)
π ykpersonalize(1) β YubiKey Personalization Tool π
okay bestie, sit down. this is ykpersonalize, straight out of the YubiKey Personalization Tool manual, and it is the tool for making a YubiKey yours. it's long so we're doing it in parts β this is part 1, so don't go anywhere. π
πΈ NAME πΈ
ykpersonalize β personalize YubiKey OTP tokens β¨
β¨ SYNOPSIS β¨
ykpersonalize [-Nkey] [-1 | -2] [-sfile] [-ifile] [-fformat] [-axxx]
[-cxxx] [-ooption] [-y] [-v] [-d] [-h] [-n] [-t] [-u] [-x] [-z] [-m]
[-S] [-V] [-Dxxx_]
π DESCRIPTION π
So what does this little icon do? It sets the AES key, the user ID and a whole bunch of other settings inside a YubiKey. it's giving "customize your key, but make it cryptographic". π«Ά
and if you wanna know what every single parameter actually means, like, truly, the original authors are like: go read the reference manual, bestie. it lives here:
https://www.yubico.com/wp-content/uploads/2015/03/YubiKeyManual_v3.4.pdf
(it's called the YubiKey manual. yes that's the whole name. iconic.) π
π OPTIONS π
-Nkeyβ use the nth YubiKey that gets found. key #1, key #2, whichever one you're feeling. π-1β change the first configuration. this is the default, and it's the one normally used for true OTP generation. fun fact: in this configuration, the option flag-oappend-cris set by default. so it's already doing a thing for you. π₯°-2β change the second configuration. this one is for YubiKey II only, and it's normally used for static key generation. and babes, it comes stacked with defaults: the option flags-oappend-cr,-ostatic-ticket,-ostrong-pw1,-ostrong-pw2and-oman-updateare all set by default. β¨-zβ delete the configuration in the selected slot. bye bye ππ-sfileβ save the configuration to a file instead of to the key. (if the file is-, it goes to stdout.) πΎ-ifileβ read the configuration from a file (if the file is-, it reads from stdin). heads up: configuration import is only valid for theycfgformat. no exceptions, no cap. π₯-fformatβ the format used with-sand-i. valid options areycfgandlegacy. pick your fighter. π₯-a[xxx]β the AES secret key, as a 32 char hex value (or 40 for OATH-HOTP/HMAC CHAL-RESP). and listen β it's hex, not modhex. leave the argument off (just-a) and it'll prompt you for the key on stdin. and if you don't use-aat all, a random key gets generated for you. cute, right? π²-c[xxx]β a 12 char hex value (again, not modhex) to use as the access code for programming. β οΈ NOTE: this does NOT SET the access code. that's what-oaccess=is for. if you don't give it an argument, it prompts for the code on stdin. don't mix these two up, i'm begging. π-ooptionβ change a configuration option. here's the menu of possible option arguments, and yes we're going through all of them:fixed=fffffffffffβ the modhex public identity of the YubiKey, 0-32 characters long (that's encoding up to 16 bytes). you can also hand it over in hex β just prepend the value withh:. the fixed part gets emitted before the OTP when the button on the YubiKey is pressed, and it can be used as an identifier for the user, for example. π·οΈuid[=uuuuuu]β the uid part of the generated OTP, also known as the private identity, in hex. must be 12 characters long. the uid is 6 bytes of static data included (encrypted) in every OTP, and it's what validates that an OTP was actually encrypted with the AES key shared between the YubiKey and the validation service. π«’ and no, you cannot use it to identify the YubiKey β it's only readable by the people who know the AES key. if you leave the argument off, the uid is prompted for on stdin. πaccess[=fffffffffff]β the new hex access code to set. must be 12 characters long. once an access code is set, it'll be required for all subsequent reprogramming of the YubiKey β so like, remember it, bestie. π« if you give no argument, the code is prompted for on stdin.oath-imf=xxxβ set the OATH Initial Moving Factor. this is the initial counter value for the YubiKey. it should be a value between 0 and 1048560, and it must be evenly dividable by 16. math is math. π’ticket-flagβ set/clear a ticket flag. see the TICKET FLAGS section. ποΈconfiguration-flagβ set/clear a configuration flag. see the Configuration flags section. βοΈ
-yβ always commit without prompting. no questions, just vibes. β-dβ dry-run: run it all without actually writing to a YubiKey. rehearsal era. π-vβ be more verbose. tell me everything. π£οΈ-hβ display help. π-Vβ display version. π·οΈ
π¦ YubiKey Neo only π¦
-nURI β program an NFC NDEF URI. π‘-ttext β program NFC NDEF text. βοΈ
π₯ YubiKey 3 and 4 only π₯
-mmode β set the device configuration for the YubiKey. it gets parsed in the formmode:cr_timeout:autoeject_timeout, wheremodeis:0β OTP device only.1β CCID device only.2β OTP/CCID composite device.3β U2F device only.4β OTP/U2F composite device.5β U2F/CCID composite device.6β OTP/U2F/CCID composite device.
add 80 to set MODE_FLAG_EJECT, for example: 81 π
cr_timeoutis the timeout in seconds for the YubiKey to wait on button press for challenge response (default is 15).autoeject_timeoutis the timeout in seconds before the card is automatically ejected in mode81.
β οΈ bestie, listen carefully: removing OTP mode also disables communication betweenykpersonalizeand the YubiKey. after that, any further mode changes will have to be done withykneomgr(for CCID mode) oru2f-host(for U2F mode). so like, don't do it casually. π
π YubiKey 3 and above π
-S0605...β set the scanmap to be used with the YubiKey. it must be 45 unique bytes as 90 characters. leave the argument empty to reset to the YubiKey's default. πΊοΈ
the scanmap must be sent in the order:
cbdefghijklnrtuvCBDEFGHIJKLNRTUV0123456789!\t\r
the default scanmap in the YubiKey is:
06050708090a0b0c0d0e0f111517181986858788898a8b8c8d8e8f9195979899271e1f202122232425269e2b28
an example for simplified U.S. Dvorak would be:
0c110b071c180d0a0619130f120e09378c918b879c988d8a8699938f928e89b7271e1f202122232425269e2b28
or for a French azerty keyboard (digits are shifted):
06050708090a0b0c0d0e0f111517181986858788898a8b8c8d8e8f9195979899a79e9fa0a1a2a3a4a5a6382b28
or for a French BΓPO keyboard (French Dvorak):
0b140c0938363707130512330f0d16188b948c89b8b6b787938592b38f8d9698a79e9fa0a1a2a3a4a5a69c2b28
and a Turkish example (has a dotless i instead of the usual i):
06050708090a0b340d0e0f111517181986858788898a8b8c8d8e8f9195979899271e1f202122232425269e2b28
π note: you must remove any whitespace present in these examples before using the values. every space. gone. periodt.
π YubiKey 5 and above π
-D0403...β set the deviceinfo to use with this YubiKey. π§¬
π YubiKey 2.3 and above π
-uβ update the existing configuration, rather than overwriting. only possible if the slot is configured as updatable. β»οΈ-xβ swap configuration slot 1 and 2 inside the YubiKey. only possible if both slots are configured as updatable. π
ποΈ TICKET FLAGS ποΈ
tab-firstβ send a tab character as the first character. this is usually used to move to the next input field. β‘οΈappend-tab1β send a tab character between the fixed part and the one-time password part. super useful if you have the fixed portion equal to the user name and two input fields that you navigate between using tab. π§append-tab2β send a tab character as the last character. βοΈappend-delay1β add a half-second delay before sending the one-time password part. β οΈ this option is only valid for firmware 1.x and 2.x.append-delay2β add a half-second delay after sending the one-time password part. β οΈ this option is only valid for firmware 1.x and 2.x.append-crβ add a carriage return after sending the one-time password part. β©οΈ
π§ YubiKey 2.0 firmware and above π§
protect-cfg2β when written to configuration 1, block later updates to configuration 2. when written to configuration 2, prevent configuration 1 from having the lock bit set. π
πΈ YubiKey 2.1 firmware and above πΈ
oath-hotpβ set OATH-HOTP mode rather than YubiKey mode. in this mode, the token functions according to the OATH-HOTP standard. π
π YubiKey 2.2 firmware and above π
chal-respβ set challenge-response mode. π―
β¨ CONFIGURATION FLAGS β¨
okay bestie, these are the personality flags β the ones that decide how your YubiKey actually behaves when you poke it. buckle up π
send-refβ sends out a reference string made of all 16 modhex characters before the fixed part shows up. and listen: if you pair this with-ostrong-pw2, it also throws a!in there before the rest of the string. cute, right? πpacing-10msβ chills for 10ms between each key press. slow down, queen β¨pacing-20msβ same vibe but 20ms between key presses. extra leisurely πstatic-ticketβ outputs a fixed string instead of a one-time password. lowkey important: the password is still based on the AES key, and it should be hard to guess and, fr fr, impossible to remember. so don't try to memorise it, babe π
YubiKey 1.x firmware only
these ones are giving vintage. only for the OGs π¦
ticket-firstβ sends the one-time password instead of the fixed part first. flip the order, periodt.allow-hidtrigβ lets the key be triggered through HID/keyboard by pressingcaps-,numorscroll-locktwice.
ngl this one is not recommended for security reasons. it's giving risky behaviour, bestie π
YubiKey 2.0 firmware and above
short-ticketβ caps the static string length at max 16 digits. heads up: this flag only makes sense alongside-ostatic-ticket. and when you use-oshort-ticketwithout-ostatic-ticket, it programs the YubiKey in "scan-code mode", where the key sends the contents offixed,uidandkeyas raw keyboard scancodes. for example, using the fixed stringh:8b080f0f122c9a12150f079ein this mode will sendHello World!on a qwerty keyboard π and because it sends raw scan codes, the output will differ between keyboard layouts. no cap!strong-pw1β upper-cases the two first letters of the output string. it's for compatibility with legacy systems that enforce both uppercase and lowercase characters in a password, and it does not add any security. aesthetics only, bestie πstrong-pw2β replaces the first eight characters of the modhex alphabet with the numbers0to7. just like-ostrong-pw1, this is intended to support legacy systems. again: legacy support, not a glow-up β¨man-updateβ enables user-initiated update of the static password. only makes sense with the-ostatic-ticketoption, and it is only valid for firmware 2.x. so if you're on something newer... she doesn't apply π«Ά
YubiKey 2.1 firmware and above
oath-hotp8β generates an 8-digit HOTP instead of a 6-digit one. more digits, more drama πoath-fixed-modhex1β sends the first byte of the fixed part as modhex.oath-fixed-modhex2β sends the first two bytes of the fixed part as modhex.oath-fixed-modhexβ sends the fixed part as modhex. all of it. the whole thing πoath-id=m:OOTTUUUUUUUUβ configures the OATH token id with a value you provide. see the description of this option in the 2.2 section below for the details, but heads up: a YubiKey 2.1 key can't report its serial number, so you must specify a token identifier value yourself. no autopilot here π
YubiKey 2.2 firmware and above
chal-yubicoβ Yubico OTP challenge-response mode.chal-hmacβ generates HMAC-SHA1 challenge responses.hmac-lt64β calculates the HMAC on less than 64 bytes of input. whatever is sitting in the last byte of the challenge gets used as the end-of-input marker (backtracking from the end of the payload). tiny detail, big consequences β¨chal-btn-trigβ the YubiKey will wait for the user to press the key (within 15 seconds) before answering the challenge. she's patient, she's polite πserial-btn-visibleβ the YubiKey will emit its serial number if the button is pressed during power-up. this option is only valid for the 2.x firmware line.serial-usb-visibleβ the YubiKey will indicate its serial number in the USBiSerialfield. this option is not available in the 3.0 and 3.1 firmwares. sad, I know πserial-api-visibleβ the YubiKey will allow its serial number to be read using an API call. nerdy and iconic π₯oath-id[=m:OOTTUUUUUUUU]β configures the OATH token id with a value you provide, or if you use it without a value, it just uses the standard YubiKey token identifier. slay π¦
so the standard OATH token id for a Yubico YubiKey is (modhex) OO=ub, TT=he, and (decimal) UUUUUUUU=serial number.
the reason the serial number is decimal is so humans can easily correlate the serial number printed on the back of the YubiKey with an entry in a list of associated tokens, for example. other encodings can be done using the appropriate oath-fixed-modhex options. iykyk π
note that the YubiKey must be programmed to allow reading its serial number, otherwise automatic token id creation is not possible. no serial, no auto-id, bestie.
for further details, see section "5.3.4 - OATH-HOTP Token Identifier" of the YubiKey manual at http://yubico.com/files/YubiKey_manual-2.0.pdf π
YubiKey 2.3 firmware and above
use-numeric-keypadβ sends scancodes for numeric keypad keypresses when sending digits β this helps with some keyboard layouts. this option is only valid for the 2.x firmware line. numbers, but make it keypad πfast-trigβ faster triggering when only configuration 1 is available. and note: this option is always in effect on firmware versions 3.0 and above. it's automatic, she's always on β‘allow-updateβ allows updating (or swapping) of certain parameters in a configuration at a later time. future-proofing, periodt.dormantβ hides/unhides a configuration stored in a YubiKey. peekaboo π
YubiKey 2.4/3.1 firmware and above
led-invβ inverts the behaviour of the led on the YubiKey. dark mode but for a tiny light β¨
OATH-HOTP Mode
when you're in OATH-HOTP mode, you can supply a HMAC key of 160 bits (20 bytes, 40 chars of hex) with -a. that's the tea β
Challenge-response Mode
in CHAL-RESP mode, the token will NOT generate any keypresses when the button is pressed. (although β plot twist β it is perfectly possible to have one slot with a keypress-generating configuration, and the other in challenge-response mode π). instead, you need a program capable of sending USB HID feature reports to the token to send it a challenge, and then read the response. no keypresses, just vibes π¦
Modhex
Modhex is a way of writing hex digits where the "digits" are chosen for being in the same place on most keyboard layouts. so your muscle memory never gets betrayed π
to convert from hex to modhex, you can use:
tr "[0123456789abcdef]" "[cbdefghijklnrtuv]"
to convert the other way, use:
tr "[cbdefghijklnrtuv]" "[0123456789abcdef]"
πΈ EXAMPLES πΈ
programming for YubiCloud:
ouid=`dd if=/dev/urandom 2>/dev/null | tr -d '[:upper:]' | tr -cd '[:xdigit:]' | fold -w12 | head -1`
ofixed=ff`dd if=/dev/urandom 2>/dev/null | tr -d '[:upper:]' | tr -cd '[:xdigit:]' | fold -w10 | head -1`
ykpersonalize -1 -ouid=h:$ouid -ofixed=h:$ofixed
this will program a key with a random 6 byte uid and a 12 character fixed string starting with vv. and that is suitable for upload to YubiCloud at https://upload.yubico.com/ π iconic behaviour, honestly.
π«Ά BUGS π«Ά
report ykpersonalize bugs in the issue tracker at https://github.com/Yubico/yubikey-personalization/issues β the devs wanna hear it, bestie π
π SEE ALSO π
- the
ykpersonalizehome page:https://developers.yubico.com/yubikey-personalization/ - YubiKeys can be obtained from Yubico at
http://www.yubico.com/
and that's the whole page, babe π this was ykpersonalize from Version 1.20.0, dated with the YKPERSONALIZE(1) manual page footer β so if you're reading the source, that's the version and date sitting right at the bottom, slay πβ¨ go personalize something, you got this π¦π
π¦ where this page comes from
- alpine 3.24: ykpers-doc 1.20.0-r2 Β· BSD-2-Clause
- arch rolling: yubikey-personalization 1.20.0-5 Β· BSD
- debian bookworm: yubikey-personalization 1.20.0-3 Β· BSD-2-Clause
- debian trixie: yubikey-personalization 1.20.0-5 Β· BSD-2-Clause
- epel 10: ykpers 1.20.0-15.el10_1 Β· LicenseRef-Callaway-BSD
- epel 9: ykpers 1.20.0-9.el9 Β· BSD
- fedora 43: ykpers 1.20.0-17.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: ykpers 1.20.0-17.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: ykpers 1.20.0-18.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: ykpers 1.20.0-18.fc44 Β· LicenseRef-Callaway-BSD
- nixos 26.05: yubikey-personalization 1.20.0
- nixpkgs unstable: yubikey-personalization 1.20.0
- ubuntu jammy: yubikey-personalization 1.20.0-3 Β· BSD-2-Clause
- ubuntu noble: yubikey-personalization 1.20.0-3build1 Β· BSD-2-Clause
- ubuntu questing: yubikey-personalization 1.20.0-6
- ubuntu resolute: yubikey-personalization 1.20.0-7 Β· BSD-2-Clause
- ubuntu stonking: yubikey-personalization 1.20.0-7 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms