For most Java Card implementations there is no support for the int
base type. This means you cannot store more than 16 bits in one single variable.
You can however store it in an array. And - when you think about it - it already is. The APDU buffer is nothing other than a byte array in transient memory (RAM, usually) *1.
So how you handle the APDU data in the APDU buffer is up to you:
- you could parse structures inside the APDU buffer;
- you could copy it to another array, either persistent (EEPROM / Flash using
new byte[size]
) or transient memory (RAM, through JCSystem.makeTransientByteArray()
)
- you could convert it to shorts using
Util.getShort()
and store the result in a short
array similar to a byte array;
- you could use it as input to any API that allows input from a byte array, such as one of the
Key#setValue
commands, OwnerPIN#check()
, signature verification etc. etc..
Or you can perform any combination of above.
If you want to perform calculations with larger values you'll have to implement those or have access to special libraries. For 32 bit integer calculations have a look at my X-mas special answer. This also shows that any kind of calculations on the data are possible, even if you have to implement them yourself. Java Card is Turing-complete, so as long as you don't run out of CPU time or memory you can do any possible calculation on it.
*1 OK, the APDU buffer is a rather special array in the way it is handled by the Java Card system, but during processing of data it just acts as a normal Java Card byte array.