Native Encription


I am developing smart card based system using C. In my case I have to do 3 pass authentication. My problem is with challenge generation process. I can get the random B and decrypt it and generate random A. Now I want to generate challenge. But I don't know how to make the challenge.

I have,

Random B
Random A

0x0000000000000000 as Initial Vector (8 bytes).

0x12121212121212123434343434343434 as Des Key (16 bytes).

Please tell me what is the process of generating challenge block (for DES).

Thank you.
That's not really enough information to answer your problem. If you don't really know much about cryptography, you're going to make the same mistakes as those in the past.

DES has a 56bit (7byte) key. So it makes no sense providing a 16byte key. Plus DES isn't secure anyway. It's normal to use Triple-DES (sometimes called 3DES). In which case a 16 bit might be used, the first 8 bytes is used in stages 1 and 3, and the second in stage 2.

At any rate, you need to get familiar with the subject before designing a security system, otherwise whatever you come up with won't be secure.
If I were you I would investigate the OpenSSL library:

Thanks for your help. Yes it is my mistake. It's not DES it's TDEA. Now I can do host authentication using MIFARE SAM AV1.

This is the steps.

IV = 0x0000000000000000
Key = 0x12121212121212125656565656565656

random A = 0x0A1A2A3A4A5A6A7A
shifted random B = 0x1B2B3B4B5B6B7B0B

step 1:

XOR_block_one = random A XOR IV

step 2:

ENCRIPTED_block_one = encryption ( XOR_block_one , Key )

step 3:

XOR_block_two = shifted random B XOR ENCRIPTED_block_one

step 4:

ENCRIPTED_block_two = encryption ( XOR_block_two , Key )

step 5:

challenge = ENCRIPTED_block_one + ENCRIPTED_block_two

NOTE : In my case it is Host SAM authentication and I have 16byte length randA+randB(Shift) to encrypt.

Thank you.
Last edited on
Topic archived. No new replies allowed.