Page 1 of 1

Question about javacard getInstance() API

Posted: Thu Jan 21, 2016 2:18 am
by nearsunshine
I know that there are many getInstance methods(e.g. Cipher class, Cipher.getInstance(byte algorithm,boolean externalAccess) throws CryptoException.) in java card API.

My Question:
How many instances will I get if I call Cipher.getInstance(...) twice consecutively?
In RAM, only one instance at all times or each instance per getInstance method invocation?

Re: Question about javacard getInstance() API

Posted: Thu Jan 21, 2016 10:02 pm
by Tarantino
getInstance() allocates memory from EEPROM not RAM for each call.

Re: Question about javacard getInstance() API

Posted: Thu Jan 21, 2016 10:16 pm
by UNKNwYSHSA
1 getInstance() create instance for each time this method called. Because instance of Cipher/Signature/RandomData/MessageDigest/KeyAgreement/Checksum has method init/update/doFinal, each instance need to save their own instance data, the instance can not be shared.
2 The RAM space are allocated for each instance.

Re: Question about javacard getInstance() API

Posted: Thu Jan 21, 2016 10:22 pm
by UNKNwYSHSA
Tarantino wrote:getInstance() allocates memory from EEPROM not RAM for each call.

There has any variables (internal data) ban be stored in RAM.