Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Why does HMAC_SHA256 not supported?

Algorithm School

Moderator: UNKNwYSHSA

Joevictor
Posts: 9
Joined: Tue Oct 20, 2015 6:05 am
Points :22
Contact:

Why does HMAC_SHA256 not supported?

Post by Joevictor » Wed Dec 23, 2015 10:41 pm

The code given below is from my applet which implements HMAC_SHA256. In my applet, I have to sign recData byte array using encryData byte array.

Code: Select all

 Signature m_sessionMAC = null;
    HMACKey keyType = null;
    Sign = new byte[64];

    bytesRead = apdu.setIncomingAndReceive();

    m_sessionMAC = Signature.getInstance(Signature.ALG_HMAC_SHA_256, false);

    keyType = (HMACKey) KeyBuilder.buildKey(KeyBuilder.TYPE_HMAC, KeyBuilder.LENGTH_HMAC_SHA_256_BLOCK_64, false);
    keyType.setKey(encryData,(short) 0, (short) encryData.length);
    m_sessionMAC.init(keyType, Signature.MODE_SIGN);

    echoOffset = m_sessionMAC.sign(recData, ISO7816.OFFSET_CDATA, ISO7816.OFFSET_LC, Sign , (short)0);
    Util.arrayCopyNonAtomic(Sign, ( short ) 0, recData, ( short ) 0, echoOffset);
    apdu.setOutgoingAndSend( ( short ) 0, (short) echoOffset );


For my applet, I always got 6A81(Function not supported). And I can not understand this well. Why does HMAC_SHA256 not supported? Hope someone help me out.

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Why does HMAC_SHA256 not supported?

Post by UNKNwYSHSA » Fri Dec 25, 2015 10:16 am

You can debug step by step, which line the exception raised.
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 27 guests

JavaCard OS : Disclaimer