Wiki

Clone wiki

yubiruby / Home

Welcome

Welcome to YubiRuby gem wiki! Please remeber to take a look at the Yard doc page. Yubico

Example

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 }

Have fun!

Updated