I'm trying to understand Yubico's documentation of the U2F standard, and getting hung up on the PIV attestation piece.

The security claim appears to be that the authoritatively-signed attestation certificate sent by the device upon registration will allow the relying party (~= server) to verify that the keying material produced by the U2F registration has not been stored or copied outside of the device.

I'm confused about how this can be possible. How does the attestation certificate represent the association between the public and private key material? How can the attestation certificate be signed for every keypair generated on the fly?

The only code that I can find showing how the attestation certificates are generated is the (static, self-signed) certificate used by this SoftU2F implementation in Rust: https://github.com/danstiner/rust-u2f/blob/master/u2f-core/src/self_signed_attestation.rs

There must be something I'm missing here, probably in how Yubikey specifically signs the attestation certificates, perhaps taking advantage of the fact that the keying material for every registration is in some way.

Can anyone help me understand how, for example, the attestation certificates produced by Yubikey's U2F devices and signed by this CA cert would allow a server to verify the provenance of the keying material used in the U2F registration, or the authenticity of the device model information?

Put another way: If I register a U2F device and receive its attestation certificate, key handle, and public key (as described in the protocol details), and I trust the root CA of the attestation cert... how can I use this to verify the provenance of the keying material?

  • Based on this useful answer, it appears that the attestation certificate is supposed to "sign the public key" produced in the registration exchange. I remain confused about the mechanics of how this works, or how it's expressed in the U2F output, however. – Dan Lenski Jan 24 at 1:42
  • 1
    PIV attestation appears to be a separate feature of some Yubikeys unrelated to their U2F capability. Your second link is for the U2F attestation, and that page includes a link to Yubico's U2F Root CA. – AndrolGenhald Jan 25 at 3:49

The U2F spec overview says:

The intention is that the public keys of all the 'Attestation' key pairs used by each vendor will be available in the public domain - this could be implemented by certificates chaining to a root public key or literally as a list. We will work within FIDO to decide the details on how certified vendors can publish their attestation public keys.

In practice most key vendors provide a root certificate somewhere that you can use to verify the attestation certificate. This works just like any other PKI.

Each authenticor contains an attestation private key that is used to create attestation signatures, and the associated attestation certificate that is sent as part of each registration the authenticator is used for. The attestation private key will be shared by at least 100,000 authenticators to prevent services from identifying an individual based on the attestation key. The purpose is to provide a way to prove which vendor manufactured the key, as the private key should be impossible to extract from the authenticator, and is thus known only to the vendor.

The registration response message includes an attestation certificate and a signature. The attestation certificate is a normal DER encoded X.509 certificate, and the signature is created with the attestation private key over the rest of the response message and part of the associated request.

Registration Response Message from FIDO U2F V1.2 Spec

To properly verify the attestation, first the attestation public key is extracted from the certificate and used to verify the signature of the response. Without this step, an attacker could simply take the attestation certificate from a known to be accepted authenticator and use it instead of their own device's attestation certificate.

After the response signature has been verified (tying the attestation certificate to the registration keypair), the attestation certificate itself must be verified. As an example, here is the certificate from one of my keys, decoded with the openssl x509 CLI:

        Version: 3 (0x2)
        Serial Number: 618376000 (0x24dbab40)
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN = Yubico U2F Root CA Serial 457200631
            Not Before: Aug  1 00:00:00 2014 GMT
            Not After : Sep  4 00:00:00 2050 GMT
        Subject: CN = Yubico U2F EE Serial 13503277888
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:

    Signature Algorithm: sha256WithRSAEncryption

The issuing certificate can be determined from the Issuer field, in this case it's Yubico's U2F Root CA. Assuming the application trusts that CA, it would take the public key from that root certificate (the root certificate itself would come from a list of trusted roots) and use it to verify the signature on the attestation certificate. If the verification is successful, the registration keypair will be cryptographically tied to the attestation certificate, and the attestation certificate will be cryptographically tied to the trusted root.

If you trust that the vendor has manufactured their authenticators properly so that the attestation private key and the key wrapping secret (or key storage depending on design) cannot be extracted, then you can be confident that the registered key is from an authenticator created by the vendor you obtained the root certificate from.

| improve this answer | |
  • Aha, thank you. This clears it up nicely. The part that I was missing is that every device contains not only an individualized key wrapping secret, but also an attestation private key (the latter shared by batches of 100k+ keys). – Dan Lenski Jan 25 at 18:22

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.