This discussion is archived
2 Replies Latest reply: Nov 20, 2012 5:14 AM by 966781 RSS

How to save a key in RAM

966781 Newbie
Currently Being Moderated
Hi,

iam using two AESKeys in my Applet for encrypted communication between the card and the host.
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 unencrypted communication and changing some data for key-building, the card builds the keys and sets them:
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 objects transient ?

Greetings

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points