Source

yubiruby /

Filename Size Date modified Message
bin
ext/libyubikey
lib
tasks
test
268 B
94 B
296 B
1.5 KB
1.0 KB
2.1 KB
= YubyRuby

Yubico Server wrapper in Ruby


== Installation

 $ gem install YubiRuby

== Some examples

Checking an OTP

 require 'rubygems'
 require 'YubiRuby'
 
 key = "6df89690b5f51bd9ac912c5004781e86" #use your AES key
 y = YubiRuby::Yubikey.new(key);
 puts y.key
 otp = gets().strip
 puts y.parse(otp)
 puts "Ouput: #{y}"
 puts "uid: #{y.uid}"
 puts "session counter: #{y.session_counter}"
 puts "capslock: #{y.triggered_by_capslock?}"
 puts "timestamp low/high: #{y.timestamp_low}/#{y.timestamp_high}"
 puts "session use: #{y.session_use}"
 puts "random: #{y.random}"
 puts "crc: #{y.crc}"
 puts "crc residue: #{y.crc_residue}"
 puts "crc residue ok?: #{y.crc?} (#{y.crc_residue} == #{YubiRuby::Yubikey::CRC_OK_RESIDUE})"

Generating a valid yubikey

 key = YubiRuby::FakeYubikey.new
 key.set_random_key
 key.set_random_uid
 key.public_id = "vvefeeccebek"
 puts "Yubikey generated"
 puts "public id:\t#{key.public_id}"
 puts "key:\t\t#{key.key}"
 puts "uid:\t\t#{key.uid}"
 puts "And now 3 otp"
 3.times { puts key.otp }