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

Come across error when calculating the Cryptogram

JavaCard Applet Development Related Questions and Answers.
tomc2016
Posts: 12
Joined: Tue Feb 16, 2016 3:45 am
Points :109
Contact:

Come across error when calculating the Cryptogram

Post by tomc2016 » Wed Mar 02, 2016 8:39 am

Does anyone know how I can confirm the static key in the SSD ? When I try to execute INITIAZE UPDATE COMMAND, the card Cryptogram can not verified correctly. Anybody tell me where is wrong in my code? Or how can I confirm the static key in the SSD ?

Here is my code to calculate Cryptogram.

Code: Select all

IvParameterSpec params =
new IvParameterSpec(new byte[]{0, 0, 0, 0, 0, 0, 0, 0});

if (sessionSENC.length == 16) {
byte[] temp = (byte[]) sessionSENC.clone();
sessionSENC = new byte[24];
System.arraycopy(temp, 0, sessionSENC, 0, temp.length);
System.arraycopy(temp, 0, sessionSENC, 16, 8);
}


byte[] temp = null;
SecretKey secretKey = new SecretKeySpec(sessionSENC, "DESede");

          Cipher cbcDES = Cipher.getInstance("DESede/CBC/NoPadding");
          cbcDES.init(Cipher.ENCRYPT_MODE, secretKey, params);
         
          temp = cbcDES.doFinal(data);

byte[] signature = new byte[8];
System.arraycopy(temp, temp.length - 8, signature, 0, signature.length);
return signature;

User avatar
mabel
Posts: 237
Joined: Mon May 18, 2015 3:09 am
Points :1705
Contact:

Re: Come across error when calculating the Cryptogram

Post by mabel » Mon Mar 14, 2016 3:11 am

Can you post a complete code of your applet if convenient?

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Bing [Bot] and 41 guests

JavaCard OS : Disclaimer