Giter Club home page Giter Club logo

libu2f-emu's Introduction

Universal 2nd Factor (U2F) Emulation C Library

Libu2f-emu, provides a C Library for the U2F device emulations.

API

The API is described in src/u2f-emu.h and src/u2f-emu-type.h.

It gives the possibility to create virtual emulated U2F devices with transport specific considerations. Four transports are available:

  • USB
  • NFC
  • BLUETOOTH
  • APDU

Once create, it is possible to interact with the devices by sending and receiving transport specific data through the API.

Device configuration

Each virtual device, for its configuration requires:

  • an EC x509 certificate
  • its EC private key
  • 48 bits of entropy
  • a global counter

All the files are grouped inside a setup_dir that can be created through the setup.sh script.

$ ./setup.sh <setup_dir>

Examples

For each transport, a code example is available and can be built:

$ make examples

USB:

Software that emulates U2F through a virtual USB device using UHID system API on Linux and the libu2f-emu.

$ ./examples/usb/u2f-emu-usb <setup_dir>

You can easily test the virtual device my registering it on websites or by playing with it on https://webauthn.io/.

Building

The project support two build systems:

  • Autotools
  • CMake
  • Meson

Setup the build system:

# Autotools
$ ./autogen.sh
$ ./configure

# CMake
$ mkdir build && cd build
$ cmake ..

# Meson
$ meson build && cd build

Build and install the library:

$ make
$ make install

Doc

The doc is generated using doxygen:

$ make doc

The doc can be accessed here: doc/html/index.html.

Tests

Somes testsuites come with the project, these can be generated and run: gtest is required:

$ make check

Coverage

The coverage and its html report can be easily generated: gcov, gcovr and gtest are required.

# Autotools
$ ./configure --enable-coverage
$ make coverage

# CMake
$ cmake -DCMAKE_BUILD_TYPE=Coverage ..
$ make coverage

# Meson
$ meson -Dcoverage=true build && cd build
$ make test && make coverage

The coverage html report can be accessed here: coverage/index.html.

Pkg-config

After the installation, the pkg-config informations are set:

$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkgconf u2f-emu --libs --cflags

License

This project is licensed under GPL-2.0.

Author

César MattGorko Belley [email protected]

libu2f-emu's People

Contributors

agnoctopus avatar zenithalhourlyrate avatar cyanea-bt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.