yubi.lsp

Module index



source download

Module: yubi

Author: Kirill Miazine, km@krot.org
Version: 0.1

Verify YubiKey one time passwords.

Location: http://km.krot.org/code/newlisp/yubi.lsp


This software is distributed under an ISC-style license.

newLISP library to verify YubiKey one time passwords. The library implements YubiKey Validation Protocol version 2.0, as described in the specificiation.

This library will query following servers: api.yubico.com, api2.yubico.com, api3.yubico.com, api4.yubico.com and api5.yubico.com. By setting yubi:PARALLEL to an integer from 1 to 5, it is possible to select how many servers the library will query. If yubi:PARALLEL is lower than 5, then the server(s) to query will be selected randomly. By default, 2 servers will be queried in parallel.

Requirements

Following libraries need to be obtainted and loaded first: Yubico API key and API id are also required.





§

yubi:verify

syntax: (yubi:verify otp-str)
parameter: otp-str - A string with a YubiKey one time password to verify

return: true on successfull authentication, nil otherwise

example:
 #!/usr/local/bin/newlisp

 ; Save this as a file and run from command line, giving the YubiKey OTP as the first argument

 (load "/usr/local/share/newlisp/modules/crypto.lsp")
 (load "/usr/local/share/newlisp/modules/web.lsp")
 (load "/usr/local/share/newlisp/modules/yubi.lsp")

 ; API id and key "borrowed" from http://demo.yubico.com/php-yubico/demo.php
 (setq yubi:API_ID 1851)                            ; API id
 (setq yubi:API_KEY "oBVbNt7IZehZGR99rvq8d6RZ1DM=") ; Base64 encoded API key

 (println (yubi:verify (main-args 2)))
 (exit)


- ∂ -

generated with newLISP  and newLISPdoc