Page 1 of 1

Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Posted: Tue Dec 15, 2015 4:44 am
by sakkiotto
My javacard version is JC2.2.1 for which signature class doesn't include ALG_HMAC_SHA1 method. To my best knowledge, it includes this method after JC2.2.2. So is it possible to use this method without upgrading my card JC version?

Re: Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Posted: Sun Dec 20, 2015 11:32 pm
by horse dream
You could just use the value that you find in the JC2.2.2 version for the constant ALG_HMAC_SHA1 (= (byte)24) and pass it to the Signature.getInstance() method. So using the value is not a problem. However, the smartcard must support this algorithm in order for you to be able to use.

Re: Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Posted: Sun Dec 20, 2015 11:55 pm
by sakkiotto
horse dream wrote:You could just use the value that you find in the JC2.2.2 version for the constant ALG_HMAC_SHA1 (= (byte)24) and pass it to the Signature.getInstance() method. So using the value is not a problem. However, the smartcard must support this algorithm in order for you to be able to use.


@horse dream , Thanks for your reply. But how do I know whether my smartcard supports it?

Re: Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Posted: Mon Dec 21, 2015 1:07 am
by horse dream
sakkiotto wrote:@horse dream , Thanks for your reply. But how do I exactly know whether my smartcard supports it?


If your smartcard supports JC 2.2.1, calling the getInstance() method with the value of ALG_HMAC_SHA1 will typically cause a CryptoException with reason (CryptoException.NO_SUCH_ALGORITHM) indicating that the algorithm is not supported.

Re: Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Posted: Mon Dec 21, 2015 4:23 am
by UNKNwYSHSA
The specification JC API v222 describes the function: Signature.getInstance(), and the exceptions it throws.
JC222 API Signature.getInstance()