Page 1 of 1

How to compute values using ' log' and 'sqrt' on javacard ?

Posted: Wed Jun 10, 2015 7:30 am
by btwtiger
Recently,I need to compute values using log and sqrt on a JavaCard. Is there any class for javacard to solve this issue ?
Many thanks.

Re: How to compute values using ' log'?

Posted: Wed Jun 10, 2015 7:43 am
by horse dream
Javacard doesn't support Math class and also only supports boolean, byte, short, and optionally int. Maybe you can create your own class with tricky ways and of course the result is not precise. If you let server/terminal side do complex calculation/encryption, the card only stores data,maybe you can get it working.

Re: How to compute values using ' log'?

Posted: Wed Jun 10, 2015 9:46 pm
by btwtiger
horse dream wrote:Javacard doesn't support Math class and also only supports boolean, byte, short, and optionally int. Maybe you can create your own class with tricky ways and of course the result is not precise. If you let server/terminal side do complex calculation/encryption, the card only stores data,maybe you can get it working.


Sorry to tell you I have to do all the calculation on the card side. Anyhow,thank you for your attention.

Re: How to compute values using ' log' on javacard ?

Posted: Wed Jun 10, 2015 10:04 pm
by Larson
I've not came across such a class yet. The only way to meet your request is to use some limited tricks with the crypto API.

Re: How to compute values using ' log' on javacard ?

Posted: Wed Jun 10, 2015 10:13 pm
by btwtiger
Larson wrote:I've not came across such a class yet. The only way to meet your request is to use some limited tricks with the crypto API.


Would you please give me a example ?

Re: How to compute values using ' log' on javacard ?

Posted: Wed Jun 10, 2015 10:28 pm
by Larson
e.g. You can perform an RSA modulo exponentiation using 2 as public key and a large modulus to perform squares.