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.

CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

JCIDE related questions and answers.

Moderators: product, kuafu

frollant
Posts: 2
Joined: Thu Feb 07, 2019 1:49 pm
Points :42
Contact:

CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Post by frollant » Tue Feb 12, 2019 6:50 pm

Hi,

I am trying to develop a basic applet that performs a HMAC SHA-256 operation.
I am debugging the applet with pyApdutool and JCIDE.
When executing this line :

Code: Select all

signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA256, false);
an exception CryptoException.NO_SUCH_ALGORITHM is thrown.

I tried with other values like Signature.ALG_HMAC_SHA1 and Signature.ALG_HMAC_MD5, and I still get an exception.
I am using JavaCard 2.2.2 API.

Could anybody tell me what am I missing ?

Thanks very much.

Franck

Noad99
Posts: 1
Joined: Tue Feb 12, 2019 11:24 pm
Points :10
Contact:

Re: CryptoException NO_SUCH_ALGORITHM about HMAC

Post by Noad99 » Tue Feb 12, 2019 11:31 pm

I have written a simple test applet, the piece of code just as below.
The version of my development is JCKit_JAVACOS_1.0.5.39.exe. If you have other testing results, please let me know.
It seems the JCIDE of my version does not support yet. The algorithms are a loadable component which can be customized by card os vendor.

Code: Select all

		int nErrCount=0;
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_MD5, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA1, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA_256, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		int r = nErrCount;

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Post by kuafu » Wed Feb 13, 2019 3:35 am

Please try JCKit_JAVACOS_Beta_3.0.0.5.

Please select simulator:JCRE 3.0.5, and using jc kit 3.xx or jc kit 2.x.x
You do not have the required permissions to view the files attached to this post. Please login first.
well

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Post by kuafu » Wed Feb 13, 2019 3:43 am

frollant wrote:
Tue Feb 12, 2019 6:50 pm
Hi,

I am trying to develop a basic applet that performs a HMAC SHA-256 operation.
I am debugging the applet with pyApdutool and JCIDE.
When executing this line :

Code: Select all

signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA256, false);
an exception CryptoException.NO_SUCH_ALGORITHM is thrown.

I tried with other values like Signature.ALG_HMAC_SHA1 and Signature.ALG_HMAC_MD5, and I still get an exception.
I am using JavaCard 2.2.2 API.

Could anybody tell me what am I missing ?

Thanks very much.

Franck
How to change javacard api version ? The answer is here .
viewtopic.php?f=3&t=1944
well

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: CryptoException NO_SUCH_ALGORITHM about HMAC

Post by kuafu » Wed Feb 13, 2019 3:46 am

Noad99 wrote:
Tue Feb 12, 2019 11:31 pm
I have written a simple test applet, the piece of code just as below.
The version of my development is JCKit_JAVACOS_1.0.5.39.exe. If you have other testing results, please let me know.
It seems the JCIDE of my version does not support yet. The algorithms are a loadable component which can be customized by card os vendor.

Code: Select all

		int nErrCount=0;
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_MD5, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA1, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		try {
			Signature signatureAlgorithm = Signature.getInstance(Signature.ALG_HMAC_SHA_256, false);
		} catch (CryptoException e)
		{
			if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM) {
				nErrCount++;
			}
		}
		
		int r = nErrCount;
It's quite different between JAVACOS_1.0.5.39.exe and JCKit_JAVACOS_Beta_3.0.0.5 . Now we are lacking of staff to maintain the old version (such as vesion 1.x.x ) .
well

frollant
Posts: 2
Joined: Thu Feb 07, 2019 1:49 pm
Points :42
Contact:

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Post by frollant » Mon Feb 18, 2019 5:53 pm

Thank you very much !!
Indeed, I did not select a simulator in the first place.
This is working better now. I am getting data out of my hash function.

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Post by kuafu » Mon Feb 18, 2019 8:20 pm

We had found some bug on watch view and local view ,we had fix it,and testing it now, and will release a new version soon.
well

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 6 guests

JavaCard OS : Disclaimer