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.
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).
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?