I'm designing a Java Card (2.2.2 thus Classic) applet that will, at each use, receive a RSA public key (validated using means immaterial to the question), then use that RSA public key to verify an RSA signature.
How can I keep that RSA public key in RAM (rather than writing it in EEPROM/Flash), for performance and device lifetime reasons ?
My problem is, in javacard.security.KeyBuilder
of JC 2.2.2, the buildKey(byte keyType, short keyLength, boolean keyEncryption)
API does not seem to have an option to specify transient memory; I see neither
- a suitable
keyType
combiningTYPE_RSA_PUBLIC
and transcient, as we have withTYPE_DES_TRANSIENT_DESELECT
; - not even
TYPE_RSA_PRIVATE_TRANSIENT_DESELECT
which conceivably could be abused into a public key (on platforms with no test for the size of d), for this is a novelty of Java Card Classic 3; - the
buildKey(byte algorithmicKeyType, byte keyMemoryType, short keyLength, boolean keyEncryption)
with akeyMemoryType
parameter, which also is a novelty of Java Card Classic 3.
Would bracketing all changes and uses of my RSA public key with beginTransaction()
and abortTransaction()
achieve my goal?