Why does HMAC_SHA256 not supported?
Posted: 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.
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.
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.