--
You received this message because you are subscribed to the Google Groups "FIDO Dev (fido-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fido-dev+u...@fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/b5342824-cdec-4fd1-bb16-9ef892cd5ccf%40fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/A0E12D49-7BAA-4460-8663-A0F947042B41%40gmail.com.
Luke Walker
Manager - Developer Program | Yubico
Phone: +1 206 880 3998
Hi James,Yubico's libfido2 examples implement the hmac-secret.- The 'cred' example has a -h option to enable the hmac-secret extension on a credential- The 'assert' example has a -s option to request a hmac-secret from the authenticator (32 bytes for a single salt, 64 bytes for two salts). Use the -h option to store the secret in a file.Happy coding!
On Mon, May 13, 2019 at 1:35 PM Emanuele Cesena <emanuel...@gmail.com> wrote:
On May 13, 2019, at 1:22 PM, 'James Walker' via FIDO Dev (fido-dev) <fido...@fidoalliance.org> wrote:
Hi there,I'm looking into creating a toy implementation of HMAC secret, defined as an extension to CTAP here, and was wondering if anyone knew of any existing implementations/guides I could use for reference? I think I'll end up using it in some sort of offline note manager, but the end app isn't a big concern, I just want to be able to derive a symmetric shared-secret.I've spent a fair time researching and have yet to find anything better than the explanation in the spec, which unfortunately isn't enough help for my fairly limited skills.Any help would be much appreciated :)--
You received this message because you are subscribed to the Google Groups "FIDO Dev (fido-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fido...@fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/b5342824-cdec-4fd1-bb16-9ef892cd5ccf%40fidoalliance.org.
--
You received this message because you are subscribed to the Google Groups "FIDO Dev (fido-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fido...@fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/A0E12D49-7BAA-4460-8663-A0F947042B41%40gmail.com.
Create a credential
The next step is to generate a new public key credential on the security key. Running cred will create an asymmetric key pair on the YubiKey. The private key never leaves the hardware. Only public key is disclosed to the platform. Specify the ‘-k’ option to retrieve the public key. By default, new credentials are not created with the hmac-secret enabled. So we must to specify the ‘-h’ option to enable the feature. Create a resident credential by specifying the ‘-r’ option. If a PIN has been set on the security key, then specify the PIN with the ‘-P’ option.
Run cred -r -h -k /tmp/pubkey <device> to create a new public key credential with the hmac-secret enabled. The security key will blink, tap to give user consent to perform the operation.
Create a salt
A salt is your half of the secret. In this example, we will use 32 bytes of pseudorandom data. The credential on the YubiKey has the other half of the secret. Optionally, you can pass in a second salt if you want to output two hmac-secrets (e.g. for rotating secrets). In that case you would pass in 64 bytes of data. The first sequence of 32 bytes are the first salt. The second sequence of 32 bytes are the second salt. In this example we are only going to generate one salt.
1. Run dd if=dev/urandom of=/tmp/salt bs=1 count=32 to generate the salt.Retrieve the shared symmetric secret
In order to retrieve the hmac-secret shared between the client and the security key you must first get an assertion for the corresponding credential that was generated earlier. The client verifies the obtained assertion using the public key. Specify the ‘-p’ option to request user presence. Specify the ‘-h’ option to output the shared symmetric secret. Specify the ‘-s’ option to input the salt. If a PIN has been set on the device, specify the PIN with the ‘-P’ option.
Run ./assert -p -h /tmp/secret -s /tmp/salt /tmp/pubkey <device> to retrieve the hmac-secrets. The security key will blink, tap the key to give user consent to perform the operation.
Putting it all together
Use the hmac-secret to encrypt and decrypt a message.
Use the secret to encrypt a message
echo the quick brown fox jumps over the lazy dog | openssl enc -aes256 -a -e -kfile /tmp/secret > /tmp/token
Run cat /tmp/token to view the encrypted data
Run cat /tmp/token | openssl enc -aes256 -a -d -kfile /tmp/secret to decrypt the token
the quick brown fox jumps over the lazy dog
To unsubscribe from this group and stop receiving emails from it, send an email to fido-dev+u...@fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/8011922f-3305-48f1-8933-c1559ea6bade%40fidoalliance.org.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/CAP6h0sPtWrCJm6bv-N805bZAZsOK-tKxNx-DqXLAgs6cFJXNjA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/fidoalliance.org/d/msgid/fido-dev/CAG%2BPDUqfkkA96%3D54yht9C6jEw2Ht%2B6%2BN5AF99soPwqcSx-gNnA%40mail.gmail.com.