Page 1 of 1

CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Posted: Tue Feb 12, 2019 6:50 pm
by frollant
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

Re: CryptoException NO_SUCH_ALGORITHM about HMAC

Posted: Tue Feb 12, 2019 11:31 pm
by Noad99
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;

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Posted: Wed Feb 13, 2019 3:35 am
by kuafu
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

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Posted: Wed Feb 13, 2019 3:43 am
by kuafu
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

Re: CryptoException NO_SUCH_ALGORITHM about HMAC

Posted: Wed Feb 13, 2019 3:46 am
by kuafu
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 ) .

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Posted: Mon Feb 18, 2019 5:53 pm
by frollant
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.

Re: CryptoException NO_SUCH_ALGORITHM occuring with JCIDE

Posted: Mon Feb 18, 2019 8:20 pm
by kuafu
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.