Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (82 sloc) 3.15 KB
Introduction to Yubikey client C library
This is a library written in C to validate a Yubikey OTP against the
Yubico online server. Description of included files:
* AUTHORS, COPYING, NEWS, README: meta-information about the project.
* ykclient.h, ykclient.c: Implementation of the library.
* tool.c: Source for command line tool "ykclient" to validate an OTP.
* selftest.c: Self tests of the library.
* Simple makefile to build the above parts.
*, Autoconf/Automake files.
The project is licensed under a BSD license. See the file COPYING for
exact wording. For any copyright year range specified as YYYY-ZZZZ in
this package note that the range specifies every single year in that
closed interval.
Building from Git
Skip to the next section if you are using an official packaged
You may check out the sources using Git with the following command:
$ git clone git://
This will create a directory 'yubico-c-client'. Enter the directory:
$ cd yubico-c-client
Autoconf, automake and libtool must be installed.
Generate the build system using:
$ autoreconf --install
To build using the Autoconf, automake and libtool infrastructure,
which is recommend for more advanced purposes especially for
cross-compilation and shared library support, build it as follows.
$ ./configure
$ make check install
Another way to build the package is by running 'make -f
check'. It will build each component, and also test it. See below
for sample session. This is useful if you want to target a platform
that doesn't support Autoconf/automake/libtool well.
jas@mocca:~/src/yubico-c-client$ make -f check
cc -I. -Wall -g -DPACKAGE=\"ykclient\" -DPACKAGE_VERSION=\"0\" -c -o ykclient.o ykclient.c
cc -lcurl ykclient.o tool.c -o ykclient
cc -I. -Wall -g -DPACKAGE=\"ykclient\" -DPACKAGE_VERSION=\"0\" -lcurl selftest.c ykclient.o -o selftest
ykclient_init (0): Success
ykclient_request (2): Yubikey OTP was replayed (REPLAYED_OTP)
yubikey_request (2): Yubikey OTP was replayed (REPLAYED_OTP)
strerror(0): Success
strerror(BAD_OTP): Yubikey OTP was bad (BAD_OTP)
Command-line tools
There is one command line tool, ykclient, to validate a particular
OTP. It needs a client id, which you can allocate for yourself on
Yubico's web site.
Example session below.
jas@mocca:~/src/yubico-c-client$ ./ykclient
Usage: ./ykclient <client_id> <yubikey_otp>
CLIENT_ID: your client id integer
YUBIKEY_OTP: One-time password generated by yubikey
jas@mocca:~/src/yubico-c-client$ ./ykclient 16 dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh
client id: 16
token: dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh
Verification output (2): Yubikey OTP was replayed (REPLAYED_OTP)
Talk to <>.
Jump to Line
Something went wrong with that request. Please try again.