Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

This is a java library (API) for the YubiHSM, http://yubico.com/yubihsm

tree: ec985c0650

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README
Octocat-spinner-32 TODO
Octocat-spinner-32 pom.xml
README
This is a java library (API) for the YubiHSM, http://yubico.com/yubihsm

Requirements:
- RXTX, a native library providing serial and parallel communication for the Java Development Toolkit (JDK),
  http://rxtx.qbang.org/wiki/index.php/Main_Page



How to build
------------

$ mvn package

to skip tests (tests require a YubiHSM configured in 'debug' mode):

$ mvn -Dmaven.test.skip=true package


Usage
-----

Build the javadoc to get the API documentation.

$ mvn javadoc:javadoc


Code example
------------

float timeout = 0.5; // HSM read timeout in seconds (How long to wait for the response from the current command)
int keyHandle = 12337; // The key to use in the YubiHSM (0x3031)
String mySecret = "qwerty";

// Instance of YubiHSM
YubiHSM hsm = new YubiHSM("/dev/ttyACM0", timeout);

// Generate HmacSHA1 for mySecret
String sha1 = hsm.generateHMACSHA1(mySecret, keyHandle, true, false).get("hash");
Something went wrong with that request. Please try again.