Device attestation module

Module for verifying attestation certificates and providing additional device metadata.

This is useful if you want to:

  • Restrict which types of devices that can be registered with your server

  • Give users rich data about their registered devices, such as:

    • The vendor and model name

    • An image of the device model

Dependency

Maven:

<dependency>
  <groupId>com.yubico</groupId>
  <artifactId>u2flib-server-attestation</artifactId>
  <version>0.19.1</version>
</dependency>

Gradle:

repositories{ mavenCentral() }
dependencies {
  compile 'com.yubico:u2flib-server-attestation:0.19.1'
}

Usage

The Attestation class lets you know if the attestation certificate from the registration is trusted, and provides you with metadata about the vendor as well as the device itself.

DeviceRegistration registration = U2F.finishRegistration(request, response);
Attestation attestation = metadataService.getAttestation(
    registration.getAttestationCertificate()
);

// Check if the device is trusted
assert attestation.isTrusted();

// Check that the vendor is Yubico
assert attestation.getVendorProperties().get("name").equals("Yubico");

// Get device name and image
String deviceName = attestation.getDeviceProperties().get("displayName");
String imageUrl = attestation.getDeviceProperties().get("imageUrl");