Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 11:52 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Validating OTP in perl?
PostPosted: Wed Jun 03, 2015 11:34 am 
Offline

Joined: Fri May 29, 2015 5:40 pm
Posts: 4
Edit: the first step, decryption, is below now.

Code:
    my $privatekey = pack( 'H32', $aes );       # convert from hex to binary   
    my $binary_otp = pack( 'H32', $hex );       # convert from hex to binary   

    my $cipher = Crypt::Rijndael->new( $privatekey, Crypt::Rijndael::MODE_CBC()\
 );
    my $cleartext = $cipher->decrypt( $binary_otp );

    die("Bad otp length.\n") unless ( length( $cleartext ) == 16 );


Last edited by notcached on Fri Jun 12, 2015 3:05 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  

Share On:

Share on Facebook FacebookShare on Twitter TwitterShare on Tumblr TumblrShare on Google+ Google+

 Post subject: CRC
PostPosted: Fri Jun 12, 2015 3:05 pm 
Offline

Joined: Fri May 29, 2015 5:40 pm
Posts: 4
For calculating the CRC, it turns out that the polynomial needed was 0x1021

Code:
    my $ctx = Digest::CRC->new(width=>16, poly=>0x1021, init=>0xffff,
                               refin=>1, refout=>1, xorout=>0x0000, cont=>1 );

    $ctx->add($cleartext);
    my $crc2 = $ctx->hexdigest;

    die("Bad CRC.\n") unless ( $crc2 eq "f0b8" );


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group