I want to store a secret on Yubikey and used it for the disk encryption. The crucial is, I want it to be PIN protected. There are a limited number of PIN tries, and after three attempts the Yubikey would be blocked (self-destructed).

All the solutions I found (like https://github.com/cornelinux/yubikey-luks) are based on HMAC-challenge-response Yubikey application which calculates SHA1-HMAC from the password and mixes the hash to/with the password. It protects against the brute-force attack but not against the torture (waterboarding etc.).

The problem is HMAC-chal./resp. is not PIN protected and it seems Yubikey can't store PIN protected secret directly.

I found and implemented two solutions based on PIV.

  1. I generate new RSA2048 key on the secret slot, use the key to encrypt a random secret and store the encrypted secret in the PIV-slot as an object. (certificate is usually stored there).

  2. I have constant encrypted data ("constant data" means actually rally hardcoded "const char * data = {....3,5,87... }"). I generate a new RSA2048 key on the selected slot. To obtain the secret, I just decrypt the constant data. I could sign the data and use the signature as the secret, but Yubikey mixes some random to the signature, so it's not deterministic and can't be used.

To make it more secure, I can even drop the public key, so even the public variables of the key become unknown.

I'm convinced (1) is as secure as Yubikey is, but I'm not sure about (2). I like (2) much more than (1) since it doesn't use the objects for something which they are not supposed to be used for.

Is it ok to use RSA this way? Has anybody thought about the similar Yubikey usage?

  • 1
    $\begingroup$ Assuming the second approach actually technically works (I don't know whether yubikeys expose the raw RSA exponentiation primitive this way?) this is a textbook RSA signature you are creating of your hard-coded array. $\endgroup$ – SEJPM Dec 29 '18 at 23:49

Using 1) along with enabling and forcing the admin pin and potentially card pin. You can the force touchauth which would force pin to unlock the yubikey and then continue as mentioned in 1)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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