Decrypting the output from the yubikey token
Version 0.07
The decryption module does only one thing - decrypt the \s-1AES\s0 encrypted \s-1OTP\s0 from the Yubikey. To this, it requires the \s-1OTP\s0, and the \s-1AES\s0 key.
Please note - this module does not perform authentication - it is a required component to decrypt the token first before authentication can be performed.
#!/usr/bin/perl use strict; use Auth::Yubikey_Decrypter; my $fulltoken = "dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh"; my $aeskey = "ecde18dbe76fbd0c33330f1c354871db"; my ($publicID,$secretid_hex,$counter_dec,$timestamp_dec,$session_use_dec,$random_dec,$crc_dec,$crc_ok) = Auth::Yubikey_Decrypter::yubikey_decrypt($fulltoken,$aeskey); print "publicID : $publicID\n"; print "Secret id : $secretid_hex\n"; print "Counter : $counter_dec\n"; print "Timestamp : $timestamp_dec\n"; print "Session : $session_use_dec\n"; print "Random : $random_dec\n"; print "crc : $crc_dec\n"; print "crc ok? : $crc_ok\n";
Input : token aeskey
Token - received by the Yubikey aeskey - either the modhex or hex \s-1AES\s0 key for your Yubikey (contact Yubico if you don't have the \s-1AES\s0 key)
Output :
$publicID $secretid_hex $counter_dec $timestamp_dec $session_use_dec $random_dec $crc_dec $crc_ok
Input : the modhex code Output : decoded modhex code in hex
Performs a crc check on the decoded data
Perl 5, Crypt::Rijndael
Order your Yubikey from <http://www.yubico.com>
Please report any bugs or feature requests to \*(C`bug-auth-yubikey_decrypter at rt.cpan.org\*(C', or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Auth-Yubikey_Decrypter>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Auth::Yubikey_Decrypter
You can also look for information at:
\s-1RT:\s0 \s-1CPAN\s0's request tracker <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Auth-Yubikey_Decrypter>
AnnoCPAN: Annotated \s-1CPAN\s0 documentation <http://annocpan.org/dist/Auth-Yubikey_Decrypter>
\s-1CPAN\s0 Ratings <http://cpanratings.perl.org/d/Auth-Yubikey_Decrypter>
Search \s-1CPAN\s0 <http://search.cpan.org/dist/Auth-Yubikey_Decrypter>
Phil Massyn, \*(C`<phil at massyn.net>\*(C'
Based a lot on \s-1PHP\s0 code by : \s-1PHP\s0 yubikey decryptor v0.1 by Alex Skov Jensen Thanks to almut from <http://perlmonks.org> for code guidance Thanks to Mark Foobar <http://blog.maniac.nl> for reporting the -32 bug on line 91 and 92.
Copyright 2008 Phil Massyn, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.