The exclusive promotional activities on JCOP J3H145 card and Feitian R301 Smartcard Reader are in full swing. Please check this page for details.

Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Algorithm School

Moderator: UNKNwYSHSA

sakkiotto
Posts: 12
Joined: Thu Dec 03, 2015 5:29 am
Points :86
Contact:

Is it possible to use ALG_HMAC_SHA1 in JC2.2.1?

Post by sakkiotto » Tue Dec 15, 2015 4:44 am

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?

User avatar
horse dream
Posts: 76
Joined: Thu May 21, 2015 11:48 pm
Points :136
Contact:

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

Post by horse dream » Sun Dec 20, 2015 11:32 pm

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.

sakkiotto
Posts: 12
Joined: Thu Dec 03, 2015 5:29 am
Points :86
Contact:

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

Post by sakkiotto » Sun Dec 20, 2015 11:55 pm

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?

User avatar
horse dream
Posts: 76
Joined: Thu May 21, 2015 11:48 pm
Points :136
Contact:

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

Post by horse dream » Mon Dec 21, 2015 1:07 am

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.

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

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

Post by UNKNwYSHSA » Mon Dec 21, 2015 4:23 am

The specification JC API v222 describes the function: Signature.getInstance(), and the exceptions it throws.
JC222 API Signature.getInstance()
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 0 guests

JavaCard OS : Disclaimer