How to save the key in RAM?
Posted: Tue Mar 15, 2016 5:51 am
I am trying to use two AESKeys in my Applet for encrypted communication between the card and the host.
After some un-encrypted communication and changing some data for key-building, the card builds the keys and sets them:
But now, the keys are stored in the EEPROM. After a card reset the keys must not be available anymore.
How can I save the key in RAM?
Code: Select all
public class MyApplet extends Applet
{
private AESKey host_key;
private AESKey card_key;
public MyApplet(byte[] bArray, short bOffset, byte bLength)
{
host_key = (AESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_256, false);
card_key = (AESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_256, false);
register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
}
After some un-encrypted communication and changing some data for key-building, the card builds the keys and sets them:
Code: Select all
host_key.setKey(key_block, (short)0);
card_key.setKey(key_block, (short)32);
But now, the keys are stored in the EEPROM. After a card reset the keys must not be available anymore.
How can I save the key in RAM?