P. Sherman
P. Sherman

Reputation: 135

Java Card: can this operations be implemented?

I'm new to Smart Cards and Java Card. I'm planning to implement a variation of the ElGamal key generation algorithm. It's not easy to find information, so is it possible to calculate this steps on a Java Card?

  1. Find smallest prime number greater than a number x (about 2048 bit)
  2. Determine if a number g is a primitive root mod p
  3. Modular exponentation, arithmetic on big numbers (about 2048 bit)

I know that the RSA key generation is possible on a Smart Card, but are the individual steps of the generation (like finding a prime number) also possible? If not, are there other kinds of security tokens that can do this? I'm planning to use the NXP J3D081 Card.

Upvotes: 0

Views: 308

Answers (2)

vlp
vlp

Reputation: 8106

Probably all you have is the javacard's RSA implementation (including the CRT variant). This way you can generate some large primes (as components of CRT private key) and do some modular arithmetic (see this recent question and the RSAPrivateCrtKey class).

Your platform might have some restrictions which could complicate things a bit.

Manual implementation of anything will probably be slow (even if you had the signed 32-bit integer type supported by the card).

Desclaimer: I never did this sort of computations so please do verify my thoughts.

EDIT>

The OV chip 2.0 project contains a Bignat library which offers arithmetic on big numbers (download here).

EDIT2>

OpenCrypto project provides JCMathLib which implements mathematical operations with big numbers and elliptic curve points.

Upvotes: 3

Paul Bastian
Paul Bastian

Reputation: 2647

The El gamal algorithm itself is not implemented on any card as far as i know. The requiured cryptographic primitives are not available in java card. Manual implementations are too slow as well

Upvotes: 0

Related Questions