Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 5:29 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 15 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Aug 30, 2009 9:41 pm 
Offline

Joined: Fri Jun 19, 2009 6:06 pm
Posts: 31
JakobE wrote:
1st complement (= bit flip) is thw way to go.


Thanks, Jakob - in fact, you made me a happy man, as my software seems to work properly already then :). Now, I hope to find the time this week to finish the first prototype of Yubidrone, will keep you posted.


Top
 Profile  
Reply with quote  

Share On:

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

PostPosted: Sun Aug 15, 2010 5:08 pm 
Offline

Joined: Sun Aug 15, 2010 2:26 pm
Posts: 5
hi folks :)

i'm trying to accomplish a similar Yubikey simulator, only implemented in Java.

unfortunately, i'm still stuck in the crc calculation. in Alex's php project it's written just the same, but for some reason it's not working for me - when i take the generated block (16 bytes including the crc), in order to validate the generated block i call:
Code:
new com.yubico.base.Token(block);

that runs it through its own crc check, but then i get
Quote:
java.lang.IllegalArgumentException: CRC failure

i can't figure out why is that, especially that it worked for Alex?

my CRC generation code:
Code:
   private static int calculateCrc(byte[] b) {
        int crc = 0x5af0;

        for (int i = 0; i < 14; i++) {
          crc ^= b[i] & 0xFF;
          for (int j = 0; j < 8; j++){
             int n = crc & 1;
             crc >>= 1;
             if (n != 0) {
               crc ^= 0x8408;
             }
          }
        }
        return crc;
   }

i'm aware of the difference between java and other languages in the implementation of unsigned bytes (there are no unsigned types in Java). but given that all the operations are bitwise, i don't think it should matter, should it? because negative numbers are just specific representations of the same bits..

i will publish the whole project once it's ready, but in the meantime i can appreciate your kind help ;)

many thanks,
Yuval


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 18, 2010 10:58 am 
Offline

Joined: Sun Aug 15, 2010 2:26 pm
Posts: 5
problem solved, it seems that the original crc calculation (with 0xffff as start value) was ok but i didn't use a ~ for the crc 1-complement, which caused the error.

i will publish the project soon. thanks anyway

Yuval


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 06, 2010 8:32 am 
Offline

Joined: Tue Nov 03, 2009 10:16 am
Posts: 8
Location: the Netherlands
Hi,

The original link you posted sais deprecated and takes me to a new version. That does not work for the source. Could you tell me (us?) where to get the source php?

And how's that java version coming along? That could be helpful to run on mobile platform as midlet...

_________________
----
Willem J. Kossen MSc.
LinkedIN


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 18, 2010 11:46 am 
Offline

Joined: Sun Aug 15, 2010 2:26 pm
Posts: 5
hi guys

the java-based Yubikeymulator 1.0 is located at
https://code.google.com/p/yubikeymulator/

enjoy!
Yuval


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


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