JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

decrypt DES in javacard vs java

JavaCard Applet Development Related Questions and Answers.
leogen
Posts: 13
Joined: Wed Jan 06, 2016 2:45 am
Points :94
Contact:

decrypt DES in javacard vs java

Post by leogen » Wed Jan 20, 2016 10:30 pm

Hi all!
I tested DES decryption on java card and I also did comparison between java card and java.
I got the following result:
In update method, DES CBC (M1, M2, or, PK5);
- If implementing in java, I need to have at least 16 bytes input to have output data.
- If implementing in java card, I need to have at least 8 byte to have output data.

So what reason results in this difference?

If anyone can share your knowledge with me, I would be greatly appreciated.

Tarantino
Posts: 101
Joined: Wed Aug 19, 2015 1:56 am
Points :478
Contact:

Re: decrypt DES in javacard vs java

Post by Tarantino » Thu Jan 21, 2016 9:44 pm

For Java implementation, Do you get 8 bytes in the response? If you have 8 bytes only, you should call doFinal(...).
The greatest glory in living lies not in never falling, but in rising every time we fall.--Nelson Mandela

leogen
Posts: 13
Joined: Wed Jan 06, 2016 2:45 am
Points :94
Contact:

Re: decrypt DES in javacard vs java

Post by leogen » Thu Jan 21, 2016 9:49 pm

Tarantino wrote:For Java implementation, Do you get 8 bytes in the response? If you have 8 bytes only, you should call doFinal(...).


@Tarantino, Thanks for your answer!

I do understand that calling doFinal will give me final result.
The problem is that in Java, there will be no output after calling update if input data is less than 16 bytes
However, javacard will give output of update method if the input data is more than 8 bytes length.

Tarantino
Posts: 101
Joined: Wed Aug 19, 2015 1:56 am
Points :478
Contact:

Re: decrypt DES in javacard vs java

Post by Tarantino » Thu Jan 21, 2016 9:51 pm

Just keep in mind that you should not rely on intermediate results of update anyway since the operation is not complete until doFinal is called.
The greatest glory in living lies not in never falling, but in rising every time we fall.--Nelson Mandela

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 16 guests

JavaCard OS : Disclaimer