My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 31, 2009 by simon75j
Labels: Featured, Phase-Deploy
ReadMe  
Introduction to Yubikey client C library

Introduction

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.mk: Simple makefile to build the above parts.

configure.ac, Makefile.am: Autoconf/Automake files.

Building from SVN

Skip to the next section if you are using an official packaged version.

You may check out the sources using SVN with the following command:

  svn checkout http://yubico-c-client.googlecode.com/svn/trunk/ yubico-c-client

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

Building

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 simple.mk 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 simple.mk  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
./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)
jas@mocca:~/src/yubico-c-client$ 

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
Input:
  client id: 16
  token: dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh
Verification output (2): Yubikey OTP was replayed (REPLAYED_OTP)
jas@mocca:~/src/yubico-c-client$ 

Questions?

Talk to <simon@yubico.com>.


Sign in to add a comment
Hosted by Google Code